刚刚安装了iOS 9开放式测试版(版本3),现在我遇到了SpriteKit着色器的大量问题.在iOS 8上,以下代码工作正常:
_fontShader = [SKShader shaderWithFileNamed:@"TheShader"]; // TODO: iOS9 compatibility issues here
_fontUniform = [SKUniform uniformWithName:@"labelBase" float:0];
[self.fontShader addUniform:self.fontUniform]; // TODO: iOS9 compatibility issues here
_fontEffects = [SKEffectNode node];
self.fontEffects.shader = self.fontShader; // TODO: iOS9 compatibility issues here
self.fontEffects.shouldEnableEffects = YES;
self.fontEffects.shouldCenterFilter = NO;
self.fontEffects.shouldRasterize = YES;
[self addChild:self.fontEffects];
Run Code Online (Sandbox Code Playgroud)
编辑:文件"TheShader.fsh"如下所示:
float yPos = gl_FragCoord.y - labelBase; // iOS 9 Compatibility issues here
float gradient = 0.35*(yPos / u_sprite_size.y); // ranges from 0 at base to 0.35 at top
vec4 …Run Code Online (Sandbox Code Playgroud) 我有一个可重复的崩溃,以EXC_BREAKPOINT结尾,如下图所示:
重现崩溃的步骤:
编辑:通过调用Progress.cancel()来重现崩溃的另一种方法步骤:
我在线上的代码didFinishReceivingResourceWithName:
func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, at localURL: URL, withError error: Error?) {
// transfer to local URL
MusicDownloadRequestor.sharedInstance.finishReceivingSongUploadAtLocalURL(tempUrl: localURL)
}
Run Code Online (Sandbox Code Playgroud)
看起来我的代码在堆栈跟踪中看起来不像...
* thread #25: tid = 0x806ec, 0x0000000100944af4 libswiftFoundation.dylib`static Foundation.DateComponents._unconditionallyBridgeFromObjectiveC (Swift.Optional<__ObjC.NSDateComponents>) -> Foundation.DateComponents with unmangled suffix "_merged" + 96, queue = 'com.apple.MCSession.callbackQueue', stop reason = EXC_BREAKPOINT (code=1, subcode=0x100944af4)
frame #0: 0x0000000100944af4 libswiftFoundation.dylib`static Foundation.DateComponents._unconditionallyBridgeFromObjectiveC …Run Code Online (Sandbox Code Playgroud) 我正在iOS9 Beta 4中测试我的应用程序,并发现许多过去在iOS8中工作但不再按预期运行的代码.另一个例子是SpriteKit的SKEmitterNode"particleAction"属性.以下代码在iOS8中有效,但在iOS9上不起作用:
// create the particle movement action
SKAction *move = [SKAction moveByX:100 y:100 duration:5]; // also, I've tested several other SKActions, such as scaleBy, fade, rotate, to no effect here
// create a target node and add to the SKScene
SKNode *targetNode = [SKNode node];
targetNode.position = origin;
[mySKSceneNode addChild:targetNode];
// add an emitter node that has a target and an SKAction
SKEmitterNode *flameTrail = [NSKeyedUnarchiver unarchiveObjectWithFile:[[NSBundle mainBundle]pathForResource:@"FlameAttack" ofType:@"sks"]];
flameTrail.position = origin;
flameTrail.particleAction = move; // TODO iOS9 …Run Code Online (Sandbox Code Playgroud)