B21-iOS 开发的一些tips(下)

1、有时导入SDK后编译报错如下

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

   检查一下导入SDK方式是否有问题,删除后重新导入即可解决。

 

2、用NSTimer定时刷新按钮的文字,避免按钮闪烁的办法

      将UIButton的类型由system改为custom就OK

 

3、NSInteger、NSUInteger与int、long的关系

    NSInteger、NSUInteger会根据系统的位数(32or64)自动选择类型(int or long)。

 

4、关于给UIView及其子类切角的问题

//  1、设置了backgroundColor,给layer切角效果并看不出来
answerL.backgroundColor = [UIColor orangeColor];
answerL.layer.cornerRadius = answerL.width/2;
// 2、可以把backgroundColor设置给layer answerL.layer.backgroundColor = [UIColor orangeColor].CGColor; // 3、也可以设置layer的属性 answerL.layer.masksToBounds = YES;

 

5、applicationIconBadgeNumber的问题

     在iOS8之后,需要先注册推送通知,此方法才能生效。

 

6、iOS设备的UDID获取

地址:http://zengrong.net/post/2152.htm

 

7、通过Safari安装app

地址:http://mobile.51cto.com/hot-439095.htm

 

8、用AFN发送请求的时候服务器返回如下错误

  错误信息:"unacceptable content-type: text/html"  
  解决方案:需要修改AFN内的AFURLResponseSerialization.m文件  
  self.acceptableContentTypes = [NSSetsetWithObjects:@"application/json", @"text/html",@"text/json",@"text/javascript", nil];
  

9、iOS国际化

 

10、远程推送的处理

  1、应用未启动
    applicationIconBadgeNumber加1, 点击推送消息启动应用或者点击应用图标应用启动,调用
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions

而不会调用

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

  2、应用在后台

    applicationIconBadgeNumber加1, 点击推送消息,应用进入前台,调用

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo;
- (void)applicationWillEnterForeground:(UIApplication *)application;

    点击应用图标,应用进入前台,调用

- (void)applicationWillEnterForeground:(UIApplication *)application;

    (此时需要通过applicationIconBadgeNumber的数字,来判断是否有推送,有的话需要重新请求数据)

  3、应用在前台

    applicationIconBadgeNumber不会变,会触发

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo;

 

11、日期格式汇总

http://www.zfshixun.com/TecnologySharing/IOS/pages/2013-10-09/897.html

posted @ 2015-11-22 18:50  朱亚男  阅读(246)  评论(0编辑  收藏  举报