objective-c - Objective C - 应用程序可以在模拟器和其他 iPhone 上运行,但无法在我自己的 iPhone 4 上运行

标签 objective-c cocos2d-iphone ios-simulator ccsprite

我的应用程序在模拟器和其他设备上运行良好。我有一台装有最新 iOS 更新的 iPhone 4,但该应用程序拒绝在我的设备上运行。

这似乎是视网膜显示图像的问题。尝试在手机上运行时出现的错误是:

2012-01-11 09:27:47.404 rr_game1[1569:707] cocos2d: cocos2d v1.0.1
2012-01-11 09:27:47.413 rr_game1[1569:707] cocos2d: Using Director Type:CCDirectorDisplayLink
2012-01-11 09:27:47.845 rr_game1[1569:707] cocos2d: OS version: 5.0.1 (0x05000100)
2012-01-11 09:27:47.849 rr_game1[1569:707] cocos2d: GL_VENDOR:   Imagination Technologies
2012-01-11 09:27:47.853 rr_game1[1569:707] cocos2d: GL_RENDERER: PowerVR SGX 535
2012-01-11 09:27:47.856 rr_game1[1569:707] cocos2d: GL_VERSION:  OpenGL ES-CM 1.1 IMGSGX535-63.14.2
2012-01-11 09:27:47.861 rr_game1[1569:707] cocos2d: GL_MAX_TEXTURE_SIZE: 2048
2012-01-11 09:27:47.864 rr_game1[1569:707] cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 16
2012-01-11 09:27:47.867 rr_game1[1569:707] cocos2d: GL_MAX_SAMPLES: 4
2012-01-11 09:27:47.871 rr_game1[1569:707] cocos2d: GL supports PVRTC: YES
2012-01-11 09:27:47.874 rr_game1[1569:707] cocos2d: GL supports BGRA8888 textures: YES
2012-01-11 09:27:47.877 rr_game1[1569:707] cocos2d: GL supports NPOT textures: YES
2012-01-11 09:27:47.880 rr_game1[1569:707] cocos2d: GL supports discard_framebuffer: YES
2012-01-11 09:27:47.883 rr_game1[1569:707] cocos2d: compiled with NPOT support: NO
2012-01-11 09:27:47.886 rr_game1[1569:707] cocos2d: compiled with VBO support in TextureAtlas : YES
2012-01-11 09:27:47.889 rr_game1[1569:707] cocos2d: compiled with Affine Matrix transformation in CCNode : YES
2012-01-11 09:27:47.892 rr_game1[1569:707] cocos2d: compiled with Profiling Support: NO
2012-01-11 09:27:48.012 rr_game1[1569:707] Game manager singleton, init
2012-01-11 09:27:48.031 rr_game1[1569:707] cocos2d: WARNING: Image (1024 x 4096) is bigger than the supported 2048 x 2048
2012-01-11 09:27:48.035 rr_game1[1569:707] cocos2d: Couldn't add image:grid.png in CCTextureCache
2012-01-11 09:27:48.047 rr_game1[1569:707] cocos2d: WARNING: Image (1024 x 4096) is bigger than the supported 2048 x 2048
2012-01-11 09:27:48.050 rr_game1[1569:707] cocos2d: Couldn't add image:bg-circuits.png in CCTextureCache
2012-01-11 09:27:48.054 rr_game1[1569:707] *** Assertion failure in -[CCParallaxNode addChild:z:parallaxRatio:positionOffset:], /Users/kevin/code/rr_game1/rr_game1/libs/cocos2d/CCParallaxNode.m:91
2012-01-11 09:27:48.058 rr_game1[1569:707] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Argument must be non-nil'

奇怪的是,它呕吐的图像在应用程序中。

Screenshot of resources dir

同样,该应用程序可以在其他设备和模拟器中运行。这是加载图像的代码:

backgroundNode = [CCParallaxNode node];
[self addChild:_backgroundNode z:-1];

_backgroundGrid1 = [CCSprite spriteWithFile:@"grid.png"];
_backgroundCircuits1 = [CCSprite spriteWithFile:@"bg-circuits.png"];

_backgroundGrid1.anchorPoint = CGPointMake(0,0);
_backgroundCircuits1.anchorPoint = CGPointMake(0,0);
CGPoint gridSpeed = ccp(0.05, 0.05);
CGPoint circuitSpeed = ccp(0.1, 0.1);

[_backgroundNode addChild:_backgroundGrid1 z:1 parallaxRatio:gridSpeed positionOffset:ccp(0,-winSize.height)];
[_backgroundNode addChild:_backgroundCircuits1 z:0 parallaxRatio:circuitSpeed positionOffset:ccp(0,-winSize.height)];

我已从手机中删除了该应用程序,运行“干净”,重新启动 Xcode,然后重新启动计算机。还是没有运气。我还重新配置了我的手机。我还删除了 Assets 并将其重新添加到项目中。

最佳答案

说实话,它确实在您的日志文件中表明 1024 x 4096 的图像大小远远大于支持的 2048 x 2048:

2012-01-11 09:27:48.031 rr_game1[1569:707] cocos2d: WARNING: Image (1024 x 4096) is bigger than the supported 2048 x 2048
2012-01-11 09:27:48.035 rr_game1[1569:707] cocos2d: Couldn't add image:grid.png in CCTextureCache
2012-01-11 09:27:48.047 rr_game1[1569:707] cocos2d: WARNING: Image (1024 x 4096) is bigger than the supported 2048 x 2048
2012-01-11 09:27:48.050 rr_game1[1569:707] cocos2d: Couldn't add image:bg-circuits.png in CCTextureCache

你说它可以在其他设备上运行,但它们是什么设备?如果它们未启用视网膜,我想相应的图像尺寸将为 512x2048,从而适合 2048x2048 最大尺寸。

如果您的视网膜显示图像超出了这些尺寸,它根本无法工作 - 2048x2048 应该已经包含了视网膜尺寸的图像。您可能需要修改游戏以使用较小的尺寸。

关于objective-c - Objective C - 应用程序可以在模拟器和其他 iPhone 上运行,但无法在我自己的 iPhone 4 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8821980/

相关文章:

objective-c - block : Release object in completion handler?

ios - 如何防止用户离开 View Controller ?

objective-c - 等待完成 block 在 AFNetworking 请求中完成

objective-c - 无法读取 Plist...我做错了什么?

ios - Cocos2d - 在 CCSprite 实例上调用 CCMoveTo 操作期间进行 TMX 碰撞检查

ios - 每 3 场比赛播放插页式广告

xcode4 - Xcode 4 - IOS - 模拟器不能用作构建目标

xcode - locationManager didFailWithError null phonegap 模拟器

objective-c - 带拖动刷新的 TTWebController

ios - Xcode 6 - 需要 iOS6 模拟器