美文网首页ios
iOS 遇到的恶心bug

iOS 遇到的恶心bug

作者: iOS苦逼开发 | 来源:发表于2016-06-03 16:53 被阅读1860次

1.报错显示:

clang: error: cannot specify -o when generating multiple output files

clang: error: no input files

解决:

在工程文件targets-->build phases-->compile sources找到了几个空白的文件,删除掉了之后就没有报错了,常见于多人开发

2.报错显示:

view reuse identifier in nib (goods) does not match the identifier used to register the nib (like)

解决:

原因在于cell的注册要在collectionView / tableView 添加进view之前完成,在self.view执行addSubview之前,注册好指定的cell就行了

3.报错显示

ld: 5 duplicate symbols for architecture x86_64

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

解决:

重复导入了一些文件,在工程文件target -> build phases -> compile sources中找到提示中出现的文件,删除重复导入的.m文件,如果继续报错,删除原有的,重新导入,,常见于多人开发

4.报错显示:

read failed: the data couldn't be read because it isn't in the correct format.

解决:

国际化语言包常见错误,检查string文件, 书写key值的时候部分后面缺少分号

5.报错显示:

ld: '/Users/***/Desktop/***/Pods/AlipaySDK/alipay/AlipaySDK.framework/AlipaySDK' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7

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

解决:

TARGETS->Build Settings->Enable Bitcode,设置成NO

6.报错显示

Undefined symbols for architecture armv7:

"_OBJC_CLASS_$_UNUserNotificationCenter", referenced from:

objc-class-ref in libXG-SDK.a(XGPush.o)

ld: symbol(s) not found for architecture armv7

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

解决:

缺少某些类库文件,referenced from前的即是提醒缺少的库,在targets中添加进去即可

7.报错描述

Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: internal server error (500)"

服务器需要在header里面添加一些值,所以请求的时候添加数据,打印发现添加的header如下

"Accept-Language" = "zh-Hans-CN;q=1, en-CN;q=0.9, th-CN;q=0.8, ko-CN;q=0.7, zh-Hant-CN;q=0.6";

"User-Agent" = "TopTao/1.0.0 (iPod touch; iOS 9.3.5; Scale/2.00)";

"device_token" = **********;

"device_type" = ios;

token = ****************;

"user_id" = ****;

添加了deviece_token,device_type,token,user_id四个,打印发现其中只有token这个key没有双引号,原因我也还没找出来,服务器那边接收数据发现只能识别到token,iOS这边有问题,安卓没事,iOS用原生和第三方打印出来都是一样的状况

解决方法:

目前的解决方法是服务器做更改,服务器使用的框架对header的解析都是不一样的,在公司里服务端用的是express,改成restify可以识别出来,或者客户端的header的key值使用驼峰命名法,如device_type改成deviceType

8.报错描述:

Cannot synthesize weak property because the current deployment target does not support weak references

解决方法:

1、项目->TARGETS->IOS->Build Settings->Apple LLVM 7,1 - Language - Objective C->WeakReferences inManual Retain Release改为YES

2、如果不行,尝试在podfile文件底下加入下面的代码,'8.0'是对应的部署目标(deployment target) 

post_installdo|installer|

        installer.pods_project.targets.eachdo|target|

                  target.build_configurations.eachdo|config|  

                            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] ='8.0'

                  end

         end

end

原文链接:https://stackoverflow.com/questions/37160688/set-deployment-target-for-cocoapodss-pod

9.报错描述:

/Users/xiao/Library/Developer/Xcode/DerivedData/****-*****/Build/Products/Debug-iphoneos/*****.app: errSecInternalComponent

Command /usr/bin/codesign failed with exit code 1

具体描述

解决方法:签名机制问题,重启电脑

相关文章

网友评论

  • 曼无世界:clang: error: cannot specify -o when generating multiple output files

    clang: error: no input files,这个问题楼主是怎么解决的,我没找到空白文件
    沐时:你好,这个问题你解决了吗?求指教

本文标题:iOS 遇到的恶心bug

本文链接:https://www.haomeiwen.com/subject/ormzkttx.html