Xcode7.0

来源:互联网 发布:u盘格式化怎么恢复数据 编辑:程序博客网 时间:2024/06/05 13:21

1. 自己公司的项目,自己电脑升级IOS9.0之后,出现的问题.请访问这个网址: http://mobile.51cto.com/anews-493604.htm

报错:

Oct  2 09:01:06  SYLShops[602] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Oct  2 09:01:06  SYLShops[602] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Oct  2 09:01:06  SYLShops[602] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
2015-10-02 09:01:36.965 SYLShops[602:14256] ===0
2015-10-02 09:01:37.025 SYLShops[602:14256] ===0
2015-10-02 09:01:37.081 SYLShops[602:14873] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
2015-10-02 09:01:37.261 SYLShops[602:14256] Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x7fe39a631490 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSErrorFailingURLStringKey=http://api.liwushuo.com/v2/item_categories/tree, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLKey=http://api.liwushuo.com/v2/item_categories/tree}}, NSErrorFailingURLStringKey=http://api.liwushuo.com/v2/item_categories/tree, NSErrorFailingURLKey=http://api.liwushuo.com/v2/item_categories/tree, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
2015-10-02 09:01:37.261 SYLShops[602:14256] 请求失败
2015-10-02 09:01:37.262 SYLShops[602:14256] Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x7fe39c8889b0 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSErrorFailingURLStringKey=http://api.liwushuo.com/v2/item_categories/tree, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLKey=http://api.liwushuo.com/v2/item_categories/tree}}, NSErrorFailingURLStringKey=http://api.liwushuo.com/v2/item_categories/tree, NSErrorFailingURLKey=http://api.liwushuo.com/v2/item_categories/tree, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
2015-10-02 09:01:37.262 SYLShops[602:14256] 请求失败
2015-10-02 09:01:37.530 SYLShops[602:14256] Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSUnderlyingError=0x7fe39a4b39f0 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSErrorFailingURLStringKey=http://api.liwushuo.com/v2/items?gender=1&generation=0&limit=50&offset=0, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLKey=http://api.liwushuo.com/v2/items?gender=1&generation=0&limit=50&offset=0}}, NSErrorFailingURLStringKey=http://api.liwushuo.com/v2/items?gender=1&generation=0&limit=50&offset=0, NSErrorFailingURLKey=http://api.liwushuo.com/v2/items?gender=1&generation=0&limit=50&offset=0, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}
2015-10-02 09:01:37.531 SYLShops[602:14256] 请求失败


1. 先解决 Error Domain=NSURLErrorDomain Code=-1022

Add a new item NSAppTransportSecurity in plist file with type Dictionary, then add sub item NSAppTransportSecurity in dictionary of type Boolean, and set bool value YES. This work for me, hope works for you guys...Cheers!

网址: http://segmentfault.com/a/1190000002933776

2. 解决CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. 问题

Had this still in XCode 7 GM, iOS9 GM. But, check it out: Set UIViewControllerBasedStatusBarAppearance to YES (even though the status bar is hidden, which is why I set it to NO to begin with), and the warnings go away. Crazy!

以上两个操作都是在plist文件中添加的.

3. NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)http://www.360doc.com/content/15/0922/09/110467_500641467.shtml   

NSAppTransportSecurity,NSExceptionDomains,NSIncludesSubdomains,NSExceptionRequiresForwardSecrecy,NSExceptionAllowInsecureHTTPLoads

4. 首页出现问题 ... 

4.1 开始加载的时候中间的东西出不来, 刷新之后顺序错乱

解决方案:把注册的方法写到header和footer判断的代理里面就好了,原因是:可能在开始的重复注册,后面注册冲掉了前面的注册标记.

4.2 重复刷新之后,item不能点击

在header头部的类里面重写-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event方法就ok了

5. 状态栏设置为白色之后,他开始的时候还是黑色

   在general中把status bar style 设置为light

   设置plist文件  Status Bar Style 设置为NO

   [[UIApplicationsharedApplication]setStatusBar:UIStatusBarStyleLightContent];

 iOS9之后:

   在general中把status bar style 设置为light

   设置plist文件  Status Bar Style 设置为YES

   重写下面代理方法

  - (UIStatusBarStyle)preferredStatusBarStyle

  {

      returnUIStatusBarStyleLightContent

  }


6.  iOS8之后, 图标上面显示消息数量的时候,需要添加一下代码才不会报警告.

  if ([[[UIDevicecurrentDevice]systemVersion]floatValue] >=8.0)

  {

     UIUserNotificationType myTypes =UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeAlert |UIRemoteNotificationTypeSound;

            

     UIUserNotificationSettings *settings = [UIUserNotificationSettingssettingsForTypes:myTypescategories:nil];

            

     [[UIApplicationsharedApplication]registerUserNotificationSettings:settings];

   }

        

        //在图标上显示所有未读数

     [UIApplicationsharedApplication].applicationIconBadgeNumber = result.totalCount;





0 0
原创粉丝点击