小编use*_*647的帖子

SpriteKit着色器崩溃iOS 9:SKDefaultShading,gl_FragCoord

刚刚安装了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)

iphone ipad ios sprite-kit ios9

11
推荐指数
2
解决办法
1446
查看次数

Swift MultipeerConnectivity无条件崩溃DateComponentsBridgeFromObjectiveC

我有一个可重复的崩溃,以EXC_BREAKPOINT结尾,如下图所示:

MultipeerConnectivity崩溃

重现崩溃的步骤:

  1. 连接两个设备
  2. 开始使用FUNC sendResource转印(在resourceURL:URL,withName资源名称:字符串,toPeer的peerID:MCPeerID,withCompletionHandler completionHandler:?((错误) - >空隙)=无) - >进展?
  3. 通过调用func disconnect()断开启动传输的设备

编辑:通过调用Progress.cancel()来重现崩溃的另一种方法步骤:

  1. 连接两个设备
  2. 开始传输并存储Progress对象let progress:Progress = session.sendResource(...)
  3. 对进度对象调用取消,导致其他设备崩溃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)

ios multipeer-connectivity swift

9
推荐指数
1
解决办法
1080
查看次数

SKEmitterNode particleAction无法运行iOS9 Beta

我正在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)

iphone ipad ios sprite-kit ios9

5
推荐指数
1
解决办法
1126
查看次数

标签 统计

ios ×3

ios9 ×2

ipad ×2

iphone ×2

sprite-kit ×2

multipeer-connectivity ×1

swift ×1