我正在尝试使用Xcode 7 beta 5编写一个简单的多玩家Swift程序。我在运行时遇到了以下错误:
[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack然后我试着出错,发现这段代码以某种方式引入了这个错误:
func setupMatchHandler() {
/* This function handles invite as sent by other users */
GKMatchmaker.sharedMatchmaker().matchForInvite(GKInvite().self , completionHandler: { (invitedMatch , invitationError) -> Void in
if invitationError != nil {
// error out
print("Game Center error: \(invitationError)")
}
if invitedMatch != nil {
// success
print("invitation received!")
}
})
}我想知道这里有哪位专家能解释出这里出了什么问题?万分感谢!
相同的
发布于 2015-08-25 04:31:39
也许给(GKInvite().self != nil)开张支票会有帮助?
看起来这是你唯一通过matchForInvite插入的东西
https://stackoverflow.com/questions/32155120
复制相似问题