iOS共享扩展异常 - 项目配置

时间:2016-09-19 08:09:52

标签: ios swift swift3 xcode8 ios8-share-extension

我在应用程序中实现共享扩展时遇到了麻烦。我使用的是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'

我不知道出了什么问题,我按照苹果开发者网站的说明进行操作。如果有人可以帮助我,我将不胜感激:)谢谢

1 个答案:

答案 0 :(得分:2)

有点晚了,但是如果有人仍然遇到这个问题,SELECT e.id, SUM(CASE WHEN r.confirmed = 1 THEN 1 ELSE 0 END) AS number_confirmed SUM(CASE WHEN r.creation_time > (CURRENT_TIMESTAMP - INTERVAL '30 MINUTE') AND r.confirmed = 0 THEN 1 ELSE 0 END) AS number_reserved, e.max_persons FROM events e, requests r WHERE l.id = ? AND r.event_id = e.id AND (r.confirmed = 1 OR r.creation_time > (CURRENT_TIMESTAMP - INTERVAL '30 MINUTE')) GROUP BY e.id, e.max_persons HAVING SUM(CASE WHEN r.confirmed = 1 OR (r.creation_time > (CURRENT_TIMESTAMP - INTERVAL '30 MINUTE')) THEN 1 ELSE 0 END) < e.max_persons"; 现在因某种原因返回SLComposeSheetConfigurationItem(),但返回值应该是一个非可选项数组,所以你可以做任何一个

Optional

let item = SLComposeSheetConfigurationItem()!