Reputation: 13
I'm having troubles implementing the share extension in an application. I'm using swift 3, xcode8.
override func configurationItems() -> [Any]! {
// To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.
let item = SLComposeSheetConfigurationItem();
item?.title = "Test";
item?.value = "Value";
item?.tapHandler = self.show;
return [item]
}
func show() {
print("TEST");
}
When I add that code to configure the items, I get the exception :
2016-09-19 09:22:20.623471 ARShareExtension[10583:675495] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_SwiftValue setChangeObserver:]: unrecognized selector sent to instance 0x17025af40'
I don't know what is wrong, I'm doing it as described in the apple developer site. I would appreciate if someone could help me :) thanks
Upvotes: 1
Views: 478
Reputation: 2616
A bit late, but if anyone still has problems with this, SLComposeSheetConfigurationItem()
is now returning an Optional
for some reason, but the return value is supposed to be an array of non-optional items, so you can do either
let item = SLComposeSheetConfigurationItem()!
or
guard let item = SLComposeSheetConfigurationItem() else { return nil }
Upvotes: 2