私は IOS バージョンの SkylinkJS に取り組んでいます。ウェブサイトで、それは良いです。すべてが正しく実行されます。しかし、IOS では、Swift でアプリを作成します。
部屋から切断しようとしているときにアプリがクラッシュすることを除いて、すべてが良好です. そして、このエラーが部屋の切断によるものであることは確かです。そのビューコントローラーに行ってどの部屋にも接続しないか、その部屋に接続して切断せずにそのままにしておくと、すべてがうまくいくでしょう。
エラーは次のとおりです。
2017-01-09 13:51:49.187237 Star Dial[8187:3318041] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
*** First throw call stack:
(0x1834c11b8 0x181ef855c 0x1833a4eac 0x1833a4d1c 0x1001bba70 0x102689218 0x102695a90 0x1001b7ee4 0x102689258 0x102689218 0x102696aec 0x10268cce0 0x102697088 0x102698e2c 0x102698b78 0x1825532a0 0x182552d8c)
libc++abi.dylib: タイプ NSException のキャッチされない例外で終了します
ボタンの切断からのコード:
if self.skylinkConn != nil {
self.skylinkConn?.disconnect({
print(">>> PROFILE DISCONNECTED")
if profile_before == "home" {
profile_before = ""
self.dismiss(animated: true, completion: nil)
} else if profile_before == "following" || profile_before == "follower" {
profile_before = ""
self.dismiss(animated: true, completion: nil)
} else {
profile_before = ""
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let next = storyBoard.instantiateViewController(withIdentifier: "HomeView") as! HomeController
self.present(next, animated: true, completion: nil)
}
})
}
profile_before はルート クラスからのものです。だから、それは理由ではありません。奇妙なことに、このエラーはいつかしか発生しないということです...たとえば、このコントローラーを 30 回、40 回開くと、1 回クラッシュします...そして、このページを約 100 回開いてクラッシュすることもあります。
確かに、それも思い出のせいではありません。メモリをチェックすると、その間の平均は 20 ~ 30 MB です