您的位置:首页 > 其它

升级xcode到4.5后遇到的问题解决方法

2012-11-20 17:24 375 查看
首先确定程序在之前的版本能正常运行

1、xcode4.5程序编译报错,类似错误:

ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/apple/Test/xxx/xxx.a for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)

没有amrv7s 说明你的手机不是iphone5因此没有armv7s架构

解决办法有三个,随便哪种都能解决:
1.升级涉及到的.a文件,升级到armv7s优化架构下生成的.a

2.在target的Build Settings里面,将Build Active Architecture Only改成YES

3.在target的Build Settings里面,找到Valid Architectures,删除其中的armv7s

2、xcode 升级到了 4.5 之后 只要往xib上面拖放控件或者在真机上调试时就会报错

解决方法, 选中当前的 xib文件,在属性栏里面进行以下操作



再右边的 inspector 一栏 将 interface builder document 下的 use autolayout 复选框去掉就可以了
http://blog.163.com/zzf_soft/blog/static/13400174720127710837169/
3、


ios6下画面旋转的问题


以前的 iOS 程式 (4.0 版以前) 都是用 addSubview 来将 app 的 root view 加到 window 上面,例如下面的作法:

[self.window addSubview:navigationController.view];

我发现在 iOS 6 上面,这个作法会使 rotation 失效 (iOS 6 以前完全没问题),必须改成这个方式:

if([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.0)

self.window.rootViewController = navigationController;


else [self.window addSubview:navigationController.view];

iOS 4 之后才支援 self.window.rootViewController = navigationController 的方式。

这样在 iOS 6 上 rotation 就正常了。

同时在响应的view中添加

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

{

// Return YES for supported orientations.

return YES;

}

//ios6下选择支持代码

- (BOOL)shouldAutorotate

{

return YES;

}

- (NSUInteger)supportedInterfaceOrientations

{

return UIInterfaceOrientationMaskAll;

}

更复杂的页面加载方式参考该blog:

http://blog.csdn.net/totogogo/article/details/8002173


和http://www.cocoachina.com/bbs/read.php?tid=116091&page=1



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: