I'm working on an Action Extension with no UI
NSExtensionPointIdentifier : com.apple.services
I'm trying to complete my extension returning an UIView
MYExternalView *viewTest = [[MYExternalView alloc] init];
NSItemProvider *resultsProvider = [[NSItemProvider alloc] initWithItem:viewTest typeIdentifier:kUTTypeMyCustomType];
NSExtensionItem *resultsItem = [[NSExtensionItem alloc] init];
resultsItem.attachments = @[resultsProvider];
[self.extensionContext completeRequestReturningItems:@[resultsItem] completionHandler:nil];
My returning view MYExternalView
extends NSSecureCoding
with very simple code:
MYExternalView.h
@interface MYExternalView : UIView < NSSecureCoding >
@end
MYExternalView.m
@implementation MYExternalView
+ (BOOL)supportsSecureCoding {
return YES;
}
@end
Running this code i had error message
<Warning>: <NSXPCConnection: 0x17410ae60> connection to service named com.*******.****.****: Warning: Exception caught during decoding of received message, dropping incoming message.
Exception: Exception while decoding argument 0 (#2 of invocation):
<NSInvocation: 0x174262580>
return value: {v} void
target: {@} 0x0
selector: {:} _completeRequestReturningItems:forExtensionContextWithUUID:completion:
argument 2: {@} 0x0
argument 3: {@} 0x0
argument 4: {@?} 0x0 (block)
Some ideas to solve my problem?
If i return another kind of object, a string for instance, everything work well.
Thanks.