我试图在我的应用程序上共享一些字符串和图像。在iPhone 6(9.3)和模拟器iPhone 5S(8.4,9.3)上分享成功。
但我在iPhone 5S(iOS 8.4)上分享失败
我的代码和崩溃。
代码:
let composer = TWTRComposer()
let postMessage = "Twitter sharing test"
let viewController = UIApplication.sharedApplication().keyWindow?.rootViewController!
composer.setText(postMessage)
composer.setImage(UIImage(named: "Twitter_Icon"))
composer.showFromViewController(viewController!) { result in
if (result == TWTRComposerResult.Cancelled) {
}
else {
}
}
崩溃:
2016-07-11 06:49:40.923 airdropTest[1600:294752] [Fabric] Unable to locate application icon
2016-07-11 06:49:40.971 airdropTest[1600:294752] [Crashlytics] Version 3.7.2 (112)
2016-07-11 06:50:05.645 airdropTest[1600:294752] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target .' * First throw call stack: (0x18554c22c 0x1971c80e4 0x18a2ea898 0x18a2ec734 0x18a0b5f40 0x1001c8af4 0x1001014a8 0x100101574 0x18a6ae7f4 0x18a2ceab0 0x18a2d0f2c 0x18a0eadb8 0x18a00055c 0x18a0000c4 0x189ffffcc 0x18990962c 0x100b2cf94 0x100b31c28 0x185503544 0x1855015ec 0x18542cf74 0x18ee8f6fc 0x18a02ed94 0x100107a08 0x197872a08)
libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)