iOS 共享扩展异常 - 项目配置
iOS share extension exception - items configuration
我在应用程序中实现共享扩展时遇到问题。我正在使用 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");
}
当我添加该代码来配置项目时,出现异常:
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'
我不知道哪里出了问题,我正在按照苹果开发者网站上的描述进行操作。如果有人能帮助我,我将不胜感激:) 谢谢
有点晚了,但如果有人对此仍有疑问,SLComposeSheetConfigurationItem()
出于某种原因现在正在 returning 一个 Optional
,但 return 值是应该是一个非可选项目的数组,所以你可以做任何一个
let item = SLComposeSheetConfigurationItem()!
或
guard let item = SLComposeSheetConfigurationItem() else { return nil }
我在应用程序中实现共享扩展时遇到问题。我正在使用 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");
}
当我添加该代码来配置项目时,出现异常:
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'
我不知道哪里出了问题,我正在按照苹果开发者网站上的描述进行操作。如果有人能帮助我,我将不胜感激:) 谢谢
有点晚了,但如果有人对此仍有疑问,SLComposeSheetConfigurationItem()
出于某种原因现在正在 returning 一个 Optional
,但 return 值是应该是一个非可选项目的数组,所以你可以做任何一个
let item = SLComposeSheetConfigurationItem()!
或
guard let item = SLComposeSheetConfigurationItem() else { return nil }