I've been using SpriteKit for a while in iOS; now I'm developing an app for the Mac.
I've setup a texture atlas as usual:
[SKTextureAtlas atlasNamed:@"Something"];
).[_atlas textureNamed:@"MyTexture"];
) and create SKSpriteNode
instances with them.I am preloading the atlas asynchronously, but the completion handler never gets called (see comments):
_atlas = [SKTextureAtlas atlasNamed:@"Something"];
if (!_atlas) {
NSLog(@"Error: Failed to create atlas!");
// This line doesn't execute, so atlas is not nil.
}
[_atlas preloadWithCompletionHandler:^(void){
// This block doesn't get executed either,
// so atlas loading somehow fails...
NSLog(@"Atlas Loaded!");
[self createSprites];
}];
When I check the package contents of the build product (e.g., MyApp.app), in the resources subdirectory I can see the atlas folder ("Something.atlasc"), but it only contains a .plist file with no entries, and the image resources are nowhere to be found... So what gives?
Actually, it wasn't the workspace after all. The same workspace/project, when copied to the Desktop, builds fine.
The cause seems to be that, one of the intermediate directories in the path to the project folder had a name in japanese characters. I tested as follows:
...(you see the pattern)...
I wonder why and how this only affects the export of texture atlases, and nothing else.
Hope this experience helps someone else in the future...
I will update the bug report at Apple as well.
UPDATE: According to Apple, the issue has been solved as of iOS 8 beta 2 (Build 12A4297e). I haven't had an opportunity to check (the project I was working at was a prototype that didn't take off, and I settled for the name change solution). In any case, iOS 8 is final now.