IOS异常笔记

来源:互联网 发布:数据挖掘专业会怎么样 编辑:程序博客网 时间:2024/05/04 13:57

1:导入别人的项目以后有时候会报错误

ld: -pie can only be used when targeting iOS 4.2 or later

clang: error: linker command failed with exit code 1 (use -v to see invocation)

这时候,选中左上角的项目文件 -->选中General选项卡 ---> DeploymentInfo 中 ---> Deployment Target,

然后把里面的版本号修改成报错信息中提示的版本号,然后再重新编译,就可以通过了。

2:IOS开发证书显示“此证书的签发者无效”解决方法

当要更新ios程序时,突然xcode提示无法成哥打包,再去看证书显示此证书已无效。还以为证书被修改或者删除了。然后多次重新配置证书,但是还是显示证书无效。原来还有个Apple Worldwide Developer Relations Certification Authority Intermediate Certificate东西在作祟。                           (1):首先打开自己的Keychain,打开所有证书,找到这条Apple Worldwide Developer Relations Certification,或发现他也是显示过期的,将其删除。                                                                                                                                                                                                                        (2):在Apple PKI网页下载最新的证书:https://developer.apple.com/certificationauthority/AppleWWDRCA.cer ,双击导入即可。

现在证书无效的问题已经全部正常了。

3:The resource could not be loaded because the App Transport Security policy requires the use of a secure connection

    1).打开项目中的info.plist文件
   2).添加一个key 名字叫NSAppTransportSecurity,type设置为Dictionary.
   3).在刚刚添加的下面添加一个子key 名字叫NSAllowsArbitraryLoads ,type为boolean,value为YES   

注意:在 iOS9 中,苹果默认全局 HTTPs,如果你要发送不安全的 HTTP 请求,需要在 info.plist 中加入如下键值对才能发出不安全的 HTTP 请求


        再次运行就可以

4:Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html"

AFNetworking 默认接收 json 格式的响应(因为这是在 iOS 平台上的框架,一般不需要 text/html),如果想要返回 html,需要设置 acceptableContentTypes

这个根据自己使用网络类的不同而设置不同,我在代码中加入
manager.responseSerializer = [AFHTTPResponseSerializer serializer];就可以了,
0 0
原创粉丝点击