关于适配Xcode6的一些问题

来源:互联网 发布:芈月 大秦 知乎 编辑:程序博客网 时间:2024/06/11 16:02

1. xcode6之后,默认生成的项目不再有prefix.pch这个预编译文件了。可以手工添加,方法为:

首先,Command+N,打开新建文件窗口:ios->other->PCH file,创建一个pch文件,添加需要引入的头文件名: 

其次,修改工程配置文件,将刚刚创建的PCH file的路径添加到building setting中的precompile header选项中去,注意debug和release两栏都要添加,这样该PCH文件就能向以前一样自动编译了:

 

至此,大功告成,编译一遍,新添加的pch文件就可以正常使用了^_^。

 2.xcode中使用Objective-C编写代码时,xcode不能够识别CGFloat\UIFont\CGSize等类,引入“#import <UIKit/UIKit.h>”可以解决。

 3.某一个自定义的类,声明了一个 @property (strong,nonatomic)NSString *description;的属性,并调用了该类的set方法(class.description)时,报如下错误
错误:FileName.h:22:43: Auto property synthesis will not synthesize property 'description' because it is 'readwrite' but it will be synthesized 'readonly' via another property

解决方法:给该属性(description)换个名字就可以了。是由于在Objective-C中每个类系统自带了description属性,表示对该类的描述,是只读的。


4.xcode6无法呼出虚拟键盘的问题

是因为xcode6中的模拟器键盘设置跟之前的版本不一样了。之前版本是模拟器的键盘和电脑的键盘都可以使用,但是xcode6的模拟器键盘只能使用其中一种,快捷切换方式:

Shift + Command + K,或者点击模拟器菜单选项 Hardware --> Keyboard,去掉 Connect Hardware Keyboard勾选。


5.xcode6推送解决方法

以前的项目在iOS SDK 8.0下编译,若有推送功能,则会报以下错误:Attempting to badge the application icon but haven't received permission from the user to badge the application

解决方案:在AppDelegate中做如下修改

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

     [selfregisterForRemoteNotification];

     return YES;

}

- (void)registerForRemoteNotification {

    if (systemVerion >=8.0) {

        UIUserNotificationType types =UIUserNotificationTypeSound |UIUserNotificationTypeBadge |UIUserNotificationTypeAlert;

        UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettingssettingsForTypes:typescategories:nil];

        [[UIApplicationsharedApplication]registerUserNotificationSettings:notificationSettings];

    } else {

        [[UIApplicationsharedApplication]registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound |UIRemoteNotificationTypeAlert)];

    }

}


#ifdef __IPHONE_8_0

- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {

    [application registerForRemoteNotifications];

}

#endif


6.xcode6下导入百度地图时,报错 ignoring file /BMKMap/BMKMap/libbaidumapapi.a, missing required architecture x86_64 in file /BMKMap/BMKMap/libbaidumapapi.a (3 slices),不支持64bit

解决方法:

targets ->build setting 下的architectures 设置为 standard architetures(armv7,armv7s),

                                          vaild architectures 设置为armv7,armv7s

若还是报错:No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).

将Build Active Architecture Only的值置为NO.

然后可能还是会出问题,这时候先在iPhone4s下run一下,然后iPhone5下run一下,然后iPhone5s就可以使用了。

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 煮水壶有水垢怎么办 猫咪喝了咖啡怎么办 军用水壶凹了怎么办 新电水壶有味道怎么办 猫夏天不喝水怎么办 军用水壶瘪了怎么办 木头壶盖有异味怎么办 挎包拉链坏了怎么办 斜挎包没有拉链怎么办 树脂补牙没抛光怎么办 猪拉稀不吃食怎么办 亚麻衣服刺皮肤怎么办 自热米饭不熟怎么办 孕妇用了微波炉怎么办 蛋挞变软了怎么办 外卖炒面坨了怎么办 手机发热充电慢怎么办 饭盒盖子松了怎么办 饭盒盖子盖不住怎么办 饭盒盖子吸不住怎么办 饭盒盖子变形了怎么办 饭盒盖子凹进去怎么办 饭盒盖吸不住怎么办 饭盒微波炉加热后打不开怎么办 微波炉加热饭盒打不开怎么办 塑料饭盒加热后打不开怎么办 真空锅锅盖打不开怎么办 玻璃真空水壶打不开怎么办 保温饭盒盖子打不开怎么办 饭盒盖章松了怎么办 电压力锅卡住了怎么办 铁的饭盒打不开怎么办 微波炉饭盒盖子打不开怎么办 微波炉盖子吸住了怎么办 剩下的糯米饭怎么办 饭盒微波加热打不开怎么办 微波炉触屏不灵怎么办 微波炉旋钮坏了怎么办 微波炉蒸馒头硬怎么办 小猫两天不吃饭怎么办 减肥吃了巧乐兹怎么办