我听说每个Sprite Kit游戏只允许使用32种不同的categorybitmask.有没有办法解决?我绝对需要更多(自游戏开放世界以来大约3-4倍).我将categorybitmask设置如下:
static const uint64_t boundaryCategory = 0x1 << 0;
static const uint64_t mainCharCategory = 0x1 << 1;
...
static const uint64_t someOtherCategory = 0x1 << 31;
Run Code Online (Sandbox Code Playgroud)
我甚至将uint32_t更改为uint64_t,希望这会使我可以使用的categorybitmask数量增加一倍.不幸的是,事实并非如此.如果有人知道绕过这个限制的任何技术,我将非常感激.
我有一个简单的免费iOS街机游戏,从App Store安装后无法正常运行,适用于iOS 7.1 - 7.1.2的iPhone用户.游戏是使用Sprite Kit和Objective-C构建的(没有任何Swift,但是它本质上非常简单,并且没有任何花哨的代码或复杂性.它也适用于安装了iOS 8.xx的任何人.下载iOS 7.1 Simulator for Xcode 6之后,我能够重现这个问题:iPhone的4S,5或5S运行iOS 7.1 - 7.1.2全部崩溃 - 所以启动图像出现,但是当它需要加载游戏时SKScene类称为MyScene,它只是不打开.在崩溃日志中,它说明如下:
+[SKLabelNode labelNodeWithText:]: unrecognized selector sent to class 0x1022503a0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[SKLabelNode labelNodeWithText:]: unrecognized selector sent to class 0x1022503a0'
*** First throw call stack:
(
0 CoreFoundation 0x00000001029a6495 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010270199e objc_exception_throw + 43
2 CoreFoundation 0x0000000102a3755d +[NSObject(NSObject) doesNotRecognizeSelector:] + 205
Run Code Online (Sandbox Code Playgroud)
崩溃后,Xcode带我到一些关于"dispatch_once"和高亮显示第68行的Apple代码页:
dispatch_once(predicate, block); Thread 1: signal SIGABRT
Run Code Online (Sandbox Code Playgroud)
基本上,在MyScene里面,有 - (id)initWithSize:(CGSize)大小方法.在里面,我创造了
static dispatch_once_t onceMS; …
Run Code Online (Sandbox Code Playgroud)