iOS 8 — расширение действия, возвращающее UIView

Я работаю над расширением действия без пользовательского интерфейса

NSExtensionPointIdentifier : com.apple.services

Я пытаюсь завершить свое расширение, возвращая 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];

Мое возвращаемое представление MYExternalView расширяет NSSecureCoding очень простым кодом:

MYExternalView.h


@interface MYExternalView : UIView < NSSecureCoding >


@end




MYExternalView.m


@implementation MYExternalView

+ (BOOL)supportsSecureCoding {
    return YES;
}

@end

Запустив этот код, я получил сообщение об ошибке

<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)

Есть идеи по решению моей проблемы?

Если я возвращаю объект другого типа, например строку, все работает хорошо.

Спасибо.


person Martino Bonfiglioli    schedule 10.11.2014    source источник
comment
Он может поддерживать безопасное кодирование, но вы не являетесь безопасным кодированием. Разве не было бы лучше, если бы вы это сделали? Передача такого UIView сомнительна; передача NSData не является.   -  person matt    schedule 10.11.2014
comment
отлично, я могу попробовать с этим stackoverflow.com/questions /1169061/how-to-serialize-a-uiview   -  person Martino Bonfiglioli    schedule 10.11.2014