Xcode解析包时出现问题的问题 请问怎么解决

拒绝访问 |
| 百度云加速
请打开cookies.
此网站 () 的管理员禁止了您的访问。原因是您的访问包含了非浏览器特征(3ad015e6f1b443a1-ua98).
重新安装浏览器,或使用别的浏览器iOS开发总结-Xcode常见错误 - 简书
iOS开发总结-Xcode常见错误
这篇文章中收录了Xcode出现的各种错误,并对错误给出了正确的解决方案,以便帮助遇到困难的朋友。
文章由作者刘小壮维护并持续更新,有新的问题并且文章中没有收录的,可以在下面评论区中提出,我会收录在文章中供大家参考。如果有问题不能解决的,也可以在下方评论区中提出,我会尽力帮助解决,并且将解决方案添加到文章中供其他人参考。
"file/file.h" file not found
如果遇到这种类型的问题报错,可以分为三部来解决,由简到复杂一步一步来,直到解决问题位置。1. 点击Xcode -& Project -& Clean清除缓存或者使用? + ? + k快捷键来清除。2. 点击Xcode -& Window -& Projects 清除Derived Data的缓存,在清除缓存之前先彻底退出Xcode,然后直接删除缓存文件夹。3. 再Build Settings -& Header Search Paths 添加路径,$(SRCROOT)/项目名称/文件路径。
如果上面这三种方法都没有解决问题,就要考虑一下文件是否存在或者导入方式是否有错误了。例如:# include&&和# include""、# import&&和# import""的导入方式是否有错误。
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)
首先注意:-pie can only be used when targeting iOS 4.2 or later
-pie只能在ios4.2或更高版本上使用,所以你可以更改工程Deployment Info —& Depoyment Target
如果你的IDE报了如下错误:
auto property synthesis is synthesizing property not explicitly synthesized
解决方法:project -& build settings -& Apple LLVM 6.0 - Warnings - Objective C -& Implicit Synthesized Properties -& NO.
这样就会消除所有的property警告了。
the file “XXX” could not be opened because you don't have permission to view it
今天使用Xcode6,突然提示我"the file “XXX” could not be opened because you don't have permission to view it" 说我没有权限。可以在Build settings-&Product Name项修改.Product Name项默认是$(TARGET_NAME),可以修改任意app名称:
如果遇到上面的情况,还有一种方式解决:Project —& Build Setting —& Build Options —& Compiler for C/C++/Objective-C中 修改这一项,变成Default Compiler(Apple LLVM 6.0)
这种方法可以解决很多因为编译器引发的问题。
有的时候会遇到这样类型的错误:
property type ‘id &maintabbardelegate&’ is incompatible with type ‘id &uitabbardelegate&’ inherited from ‘uitabbar’
UIKit 代理
自己定义的代理
这是因为自己的代理属性名和继承的父类代理属性名重名了,这种情况只需要把自己代理属性名更改就可以。
但是这种方法还不是很好的解决方式,最好的解决方式是在定义代理的时候,继承自父类的代理。这样做的好处是,符合Objective-C中的继承的特性;而且外界使用当前类的代理的时候,可以通过遵守当前类的代理,达到将父类的代理也遵守,更加方便外界使用。而且苹果官方也是这样做的。
在storyboard中,由controller A跳转到controller B的时候然后报错:
Warning: Attempt to present *** on *** whose view is not in the window hierarchy!
大致分析一下,应该是这么回事情,在controller a的viewDidLoad里面直接跳转controller b,然后导致在显示controller b的时候也调用了controller a来显示,然后发现这个window的层次结构就错乱了。在controller a中跳转的时候,要在viewDidLoad以及viewDidAppear之后才能跳转,所以可以自己想办法延时跳转,而不是直接跳转。也可以将这个方法写在其他位置,根据自身情况而定。
The document "ViewController.xib" could not be opened. Unrecognized file content.
很多情况都会造成这个错误,最常见的是因为svn或者git等版本控制工具进行代码update的时候造成的。我们解决完冲突之后将Xcode退出,删除缓存,然后在右边的列表里找到Open AS -& Interface Builder XIB Documents就可以了。这个问题应该算是Xcode的一个bug,跟我们并没有关系。
import &framework/framework.h& file not found
我们导入一个新的framework之后报file not found错误,或者当前framework导致其他framework报file not found错误,这都是因为路径导致的错误,我们需要指定一下程序的路径。解决方法:在Build Settings -& Framework Search Paths 添加路径,$(SRCROOT)/项目名称/文件路径/文件名.framework
storyboardd references cannot be the destinations of relationship segues prior to ios 9.0
iOS9之后苹果添加了一个新特性-Storyboard References,这个特性如果报以上错误,是因为这个新特性只支持iOS9及以上版本,需要将Xcode编译最低版本设置为iOS9。
Deployment Target
This application's application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed.
设备上已经有一个和当前运行程序相同identifier程序,需要将设备上相同identifier的程序删除,或者修改当前运行程序的Identifier,然后在重新运行即可。
Identifier
项目名 does not have an architecture that 设备名 can execute.
这个问题主要是因为项目设置的ARM指令集,比设备指令集高,也就是项目没有兼容低版本设备的指令集导致的。所以需要我们设置更低的指令集来兼容低版本设备,这个设备版本不是iOS系统版本,而是硬件的版本,例如iPhone5、iPhone6这样的设备。
如果重新设置了设备指令集,还是不能正常运行程序,并且出现下面的错误:
failed to send the handshake ack
如果从错误信息上来看,是一个握手符号发送失败,但是并不是这样的,也不是因为网的问题。这主要是因为我们出现上面ARM指令集错误之后导致的,需要我们手动还原系统设置。
具体操作 : 通用 -& 还原 -& 还原所有设置 (这个操作越狱机慎重)
Variables View (控制台变量) 不显示变量的值和内存地址,很多对象都显示为nil,而实际上是有值的。
这主要是因为我们将当前工程的Edit Scheme的Build Configuration设置为了release模式,在release模式下编译器会模拟真机运行状态,会对一些调试参数进行优化,包括不显示Variables View变量。
所以解决方案就是我们将Build Configuration的release模式改为debug模式,变量值和内存地址就出来了。
Unknown type name ‘ViewController’;did you mean ‘UIViewController’?
Unknown type name ‘ViewController’;
这是因为在代码中的两个类,使用#import直接或间接的循环引用导致的,这个错误是发生在编译期的。例如classA中#import了classB,classB中#import了classA,或中间隔了几层的循环引用。
解决方式是找到循环引用的类,然后在产生循环引用的任意一个类的.h文件中使用@class的方式引用,然后在类的.m中使用#import引用就可以解决。
Could not find Developer Disk Image
问题所在:这种情况一般都是出现在真机调试的过程中,是因为测试设备系统版本比Xcode的可运行版本高,所以导致Xcode找不到对应的磁盘映射文件。
解决方法1:对于这样的问题,我们可以通过升级Xcode来解决,只要把Xcode升级到最高版本这个问题就解决了。因为最新的Xcode可运行版本始终都是比最新的iOS系统高或持平,所以这种方法可以解决,而且这也是苹果希望的。
但是升级Xcode的过程中会导致不能打开Xcode,严重影响我们的工作,而且Xcode体积比较大,升级过程对网速的要求比较高。而且下载一个Xcode之后也不一定立刻能用,有时候Xcode升级了,但是Mac操作系统版本不能支持Xcode,还要升级Mac操作系统,又是一天过去了。。。
解决方法2:(个人推荐)对于这个问题,我们可以考虑添加iOS系统对应的 DeveloperDiskImage文件解决,这也就是上面我们说的Xcode磁盘映射文件,下载并添加这个文件就可以了。
具体文件可以直接Google下载一个,下载之后直接放在下面的目录即可。例如我现在要运行iOS9.3.1的系统,我就下载一个文件名为9.3 (13E230)的文件,然后放在这个目录,就可以正常运行真机了。/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
一个DeveloperDiskImage文件可以运行当前中等版本号的所有子版本号,例如这次更新的9.3.1系统的DeveloperDiskImage文件,就可以运行9.3.0—9.3.9的所有9.3开头的子版本号,对于其他系统版本同理。
Xcode升级策略:对于Xcode的升级,我自己的想法是只有在6.xx和7.xx这样的大版本更新,我才会升级Xcode,其他小版本我都不会去升级。为了保证真机运行,每次更新iOS系统后,我都会采用上面的方式来升级Xcode磁盘映射文件,但Xcode我不会去升级。
这主要还是因为Xcode体积比较大,升级一次确实不容易,而且频繁升级Xcode也没有什么大的变化。一般在6.xx和7.xx这样的大版本更新,Xcode才会有比较大的变化,这时候我才会选择升级Xcode。
iPhone6 is busy: Processing symbol files
Xcode will continue when iPhone6 is finished
Processing symbol files
真机运行时,经常会出现上面的错误,但是项目的配置、证书、设备什么的都没问题啊。
其实从Xcode上面的进度信息也可以看到,Xcode正在处理符号文件。Xcode每次连接新设备后,都会进行这步操作,只有第一次连接会这样,之后就不会了。所以我们要做的就是,等。。。
Charles无法抓包
在Mac上下载Charles后,直接就可以抓包,而手机上配置代理后也可以抓包。但是有的时候Charles会出现无法抓包的情况,重新卸载后再安装,还是无法抓包。遇到这样的情况,可以按照下面的步骤,检查一下是否是配置的问题。
1. 查看Charles下面两个选项是否勾选,如果勾选将其取消。
Proxy -& Proxy Settings -& Enable transparent HTTP proxying
Proxy -& SSL Proxying Settings -& -&SSL Proxying -& Enable SSL Proxying
2. 查看Charles下面选项是否勾选
Proxy -& Mac OS X Proxy
3. 如果用过Lantern或者其他翻墙工具,需要检查下面选项是否勾选,很多翻墙工具会配置下面选项。
系统偏好设置 -& 网络 -& 高级 -& 自动代理配置
我不能使用Charles就是因为第三种情况,我做的就是直接将其取消,测试了一下还可以照常翻墙。
ld: library not found for -lBeeHive
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这种问题一般都是缺少库文件所导致的,例如使用某个第三方库,但没有导入其文件,就会报这样的错。所以需要根据提示信息,找到缺失的库文件,并将其拖入工程中即可。
如果使用了CocoaPods,那就是没有更新podfile文件所导致的,执行pod命令并重新打开工程即可。
[!] The master repo requires CocoaPods 1.0.0 -(currently using 0.39.0)
Update CocoaPods, or checkout the appropriate tag in the repo.
升级Xcode 8和Mac10.12之后,在pod update的时候发现报这个错误。
按照错误提示来说是升级CocoaPods,尝试之后升级失败。后来以为是gem的问题,打印了一下gem的地址,也没什么问题。
http://ruby.taobao.org/
https://ruby.taobao.org/
赶快Google查了一下是什么问题。后来查到在Mac10.11之后,系统会把CocoaPods移到/usr/local/bin路径下。所以又重新安装了一遍CocoaPods,并指定了路径,就可以了。
sudo gem install -n /usr/local/bin cocoapods
之前一般都是通过不指定路径的方式安装的,所以会安装到CocoaPods默认路径下。
sudo gem install cocoapods
如果重新安装CocoaPods之后,还是报下面的错误,那就需要改一下Podfile文件。
[!] The dependency `ReactiveCocoa (= 2.0)` is not used in any concrete target.
给Podfile文件添加上target,再运行pod update就没问题了。
target “Project” do
pod 'ReactiveCocoa' , '2.0'
有志者,事竟成;破釜沉舟,百二秦关终归楚;苦心人,天不负;卧薪尝胆,三千越甲可吞吴!Xcode 8解决真机测试Log被屏蔽的问题 - IOS - 伯乐在线
& Xcode 8解决真机测试Log被屏蔽的问题
升级Xcode 8之后运行项目,会打印一些烦人的Log信息,解决的办法就是OS_ACTIVITY_MODE = disable,具体请移步:。
这种办法确实解决了我们的问题。但是又出现的一个问题就是在iOS 10模拟器上是正常的,可是在iOS 10真机测试所有的Log日志全部被屏蔽了!大家误以为是之前的设置导致这种问题的出现,其实不然。这个问题应该是iOS 10开始为了在真机上提高性能,所以把Log日志给屏蔽了。
对我们来说真机测试也是离不开Log日志的,那我们就来解决这个问题。首先我们最初自定义的Log日志是这样的:
#ifdef DEBUG
#define LRString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
#define LRLog(...) NSLog(@"%@ 第%d行 \n %@\n\n",LRString,__LINE__,[NSString stringWithFormat:__VA_ARGS__])
#define LRLog(...)
#ifdef DEBUG#define LRString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent#define LRLog(...) NSLog(@"%@ 第%d行 \n %@\n\n",LRString,__LINE__,[NSString stringWithFormat:__VA_ARGS__])&#else#define LRLog(...)#endif
系统的NSLog()已经不好使了,这个只能在iOS 9之前的系统管用,如果想要在iOS 10系统的手机也能打印日志,我们需要用到printf()如下:
#ifdef DEBUG
#define LRString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent
#define LRLog(...) printf("%s: %s 第%d行: %s\n\n",[[NSString lr_stringDate] UTF8String], [LRString UTF8String] ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]);
#define LRLog(...)
#ifdef DEBUG#define LRString [NSString stringWithFormat:@"%s", __FILE__].lastPathComponent#define LRLog(...) printf("%s: %s 第%d行: %s\n\n",[[NSString lr_stringDate] UTF8String], [LRString UTF8String] ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]);&#else#define LRLog(...)#endif
再看看我在真机测试上面打印的Log日志:
1.[[NSString lr_stringDate] UTF8String]是打印的时间,如果不喜欢打印这个时间可以去掉:
+ (NSString *)lr_stringDate {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:[NSDate date]];
return dateS
+ (NSString *)lr_stringDate {&&&&NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];&&&&[dateFormatter setDateFormat:@"YYYY-MM-dd hh:mm:ss"];&&&&NSString *dateString = [dateFormatter stringFromDate:[NSDate date]];&&&&return dateString;}
2.使用UTF8String的原因就是printf是C语言的,所以需要通过这个方法转换一下才能打印。
以上就是解决的办法,并且我也在Debug模式下和Release模式下分别测试运行是没有问题的,如果有些地方理解错误还希望有人帮忙指正。
可能感兴趣的话题
o 102 回复
关于iOS频道
iOS频道分享iOS和Swift开发,应用设计和推广,iOS相关的行业动态。
新浪微博:
推荐微信号
(加好友请注明来意)
– 好的话题、有启发的回复、值得信赖的圈子
– 分享和发现有价值的内容与观点
– 为IT单身男女服务的征婚传播平台
– 优秀的工具资源导航
– 翻译传播优秀的外文文章
– 国内外的精选文章
– UI,网页,交互和用户体验
– 专注iOS技术分享
– 专注Android技术分享
– JavaScript, HTML5, CSS
– 专注Java技术分享
– 专注Python技术分享
& 2017 伯乐在线今天把iphone 6 升级到ios10 后,用Xcode 7进行真机调试的时候提示:
Could not find Developer Disk Image
果断准备升级到Xcode 8 。但是想保留Xcode 7,解决方法:
1、打开Finder,进入&应用程序&文件夹,新建一个文件夹命名为&Xcode 7&。2、将原来的Xcode7程序拖进刚才创建的文件夹。3、安装Xcode8之前,首先要把系统升级到10.11.64、接下来安装Xcode8。为方便以后升级,把Xcode8直接安装在&应用程序&文件夹内。或者直接通过AppStore下载安装。5、至此,安装完成。打开Launchpad,可以见到有两个Xcode,且都能正常打开。6、打开xcodeproj文件时,系统会默认使用Xcode8升级以后出现的各种问题记录如下:1、升级到Xcode8 后,真机调试,原来的描述文件出问题了(一堆问题,可能每个人的问题不一样,我就不列举了,反正就是有关描述文件的问题)发现:Deprecated (如下)
然后:Target - &General -&勾选 Xcode8 新增的Automatically manage signing ,
进行team选择等
后面:Target - &BuildSeting 就可以如下配置:
通过打包测试,完全没有问题。
2. Xcode8 在&Target - &General下有个Signing , &Xcode新增的Automatically manage signing会自动管理需要的配置文件和证书。我们只需要在Xcode的Account中登录我们的AppleID账号即可,配置证书变得如此简单.
Provisioning Profile 文件选取,已经从Buiid Settings移动到了General中,Buiid Settings中已经标识了 Deprecated(说白了,可以不用弄了),以前添加设备之后需要重新生成描述文件,然后下载安装,很麻烦,现在省事多了。
当然你也可以选择手动管理配置文件,除此之外,如果签名证书有任何问题Xcode都会及时提示你.
3、一切都配置好了以后,真机调试的时候还是出现以下问题:
The certificate used to sign "你的项目名称" has either expired or has been revoked. An updated certificate is required to sign and install the application.
检查一下,没有问题啊,但是就是报这个错误。
原来测试证书的p12文件安装了好几次,上次的已经失效,影响了真机调试。在钥匙窜中找到那些失效的证书删掉即可。只留一个有效的证书。
4、升级到Xcode8(ios 10),发现在注册remote notification的,获取device token的时候失败了,错误信息为:
no valid 'aps-environment'
entitlement string found for application
原来在Xcode7中,push notifications开关只有一个步骤:将push notifications加入到app id。
但是Xcode8中,打开push notifications开关有两个步骤:多了一步写entitlements文件的步骤
所以,用Xcode8打开工程后,应该重新打开一次push notification开关,之后entitlements文件中会多出两行:
有了这两行之后,才可以正常注册device token。
使用:codesign
命令,可以看到app文件内的entitlement。
经发现:如果用production证书签名,可以看到:
说明苹果在签名过程中,会自动更新aps-environment字段。
5、IDFA可被用户禁用
iOS10中,用户可以在设置-隐私-广告-限制广告追踪中禁止app读取IDFA,这时app读取到的IDFA就是一串0。
中这样说:
In iOS 10.0 and later, the value of advertisingIdentifier is all zeroes when the user has limited ad tracking.
6、Info.plist增加权限字段
使用Xcode8构建的app,在使用相册等系统权限时会崩溃。错误信息为:
This app has crashed because it attempted to access privacy-sensitive data without a usage description.
The app's Info.plist must contain an NSPhotoLibraryUsageDescription key with a string value explaining to the user how the app uses this data.
Important: To protect user privacy, an iOS app linked on or after iOS 10.0, and which accesses the user&s photo library, must statically declare the intent to do so. Include the NSPhotoLibraryUsageDescription key in your app&s Info.plist file and provide a purpose string for this key. If your app attempts to access the user&s photo library without a corresponding purpose string, your app exits.
必须在Info.plist文件中增加NSPhotoLibraryUsageDescription键,并且填入合适的描述文本
还有很多其他的权限,如相机等,也需要在Info.plist文件中声明,具体可参考官方文档。
有一个坑就是,如果string的值为空,这行权限的声明就会无效,遇到的时候还是崩溃:
7、UITableView、UICollectionView生命周期适配
介绍了UITableView和UICollectionView的生命周期在iOS10中发生了改变。
在iOS9及之前,一个UICollectionViewCell被重用的过程是这样的:
一个cell即将出现的屏幕上
prepareForReuse
cellForItemAtIndexPath
willDisplayCell
一个cell完全离开屏幕
didEndDisplayCell
进入reuse queue
但在iOS10中,一个UICollectionViewCell被重用的过程变成了这样:
一个cell还没出现在屏幕上
prepareForReuse
cellForItemAtIndexPath
一个cell即将出现的屏幕上
一个cell完全离开屏幕
didEndDisplayCell
一段时间后再进入reuse queue
所以,iOS10后,cellForItemAtIndexPath被调用时,并不表示这个cell即将要出现在了屏幕上。还是得老老实实使用willDisplayCell和didEndDisplayCell方法。
参考文章:/p/3
阅读(...) 评论()Xcode 常见错误/警告,处理方法
整理了常见错误,这里记录下,方便后续查询。
Xcode 升级后,常常遇到的遇到的警告、错误,解决方法
从sdk3.2.5升级到sdk 7.1中间废弃了很多的方法,还有一些逻辑关系更加严谨了。
1. 警告:&xoxoxoxo& is deprecated
解决办法:查看xoxoxoxo的这个方法的文档,替换掉这个方法即可。
2. 警告:Declaration of &struct sockaddr& will not be visible outside of this function
解决办法:在你的开源.m文件中添加 #import
3. 警告:Implicit conversion from enumeration type 'UIInterfaceOrientation' to different enumeration type 'UIDeviceOrientation'
解决办法:类型不匹配。跳到出错的那一行,UIInterfaceOrientation强制转换为UIDeviceOrientation就行了。
4. 警告:incompatible pointer types assigning to 'MyArrayList*'from 'NSMutableArray'
解决办法:加入强制转换(MyArrayList*)
5. 警告:'&&' within '||'
问题出处: if (exists && !isDirectory || !exists)&&&
解决办法: if ((exists && !isDirectory) || !exists)&&&
6. 警告:Warning:The Copy Bundle Resources build phase contains this target's Info.plist file
解决办法:将Info.plist文件移到Resources目录下,而不要直接放在target下。
7.警告:在使用ASIHttp&第三方库的,运行报错。
解决办法:看你的项目中是否添加CFNetwork.framework、SystemConfiguration.framework, MobileCoreServices.framework,
CoreGraphics.framework和libz.1.2.3.dylib,如果是sdk5.0以上,改添加libz.1.2.5.dylib
8.警告:xxxooo,missingrequiredarchitecturei386infile
解决办法:如果是错误信息的话:Target-&Build Settings-&Search Paths, 删除FrameworkSearch Paths 里面内容就可以了。
要只是一个警告的话,真机调试可以过。具体解决方法待大神出现。
9.警告:clang: error:no such file or directory: '/demo2/控件代码/13/Recorder/Recorder_Prefix.pch'
clang: error: no input files
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1
解决办法: 在你的主工程文件 target搜素,pch ,找到Prefix Header 把它后面的值,都删除,再运行就解决了。
10.警告:&ARC forbids synthesizing a property of anObjective-Cobject with unspecified ownership or storage attribute
解决办法:如果定义了ARC有效,那么必须要有所有者属性的定义;所以代码改成下面这样
@property(nonatomic,strong,readonly)NSString*
11. 警告:io6一下的xib均没有自动选择Use Autolayout, SupportingiOS5 and below with xib of iOS 6
解决办法:Just un-select &Use Autolayout& in the file inspector of the xib&s view and we are back to the familiar autosizing in size inspector and boom, it supports iOS 5 and below.
12. 警告:Warning:Multiple build commands for output file xxx.png
解决办法:找到项目里xxx.png重复,删除重复的资源。
//以下是升级到 xcode 5.0.1 之后使用遇到的警告
13.警告:&iOS 模拟器&未能安装此应用程序。
解决办法:删除模拟器上当前要运行那个APP,重新运行项目。就ok
14.警告:SpringBoard无法启动应用程序 错误:-3
解决办法:退出模拟器,重新运行这个项目。
15.警告:The server certificate failed to verify.
解决办法:1、打开终端(实用工具 --&终端),在终端中输入如下命令:
svn lshttps://192.100.1.11?0/svn/xxxxxx(注意下面的url更换成你自己的url地址)
然后直接输入 & p & 确认,就可以重新连接了。
16.警告:Bitmasking for introspection of Objective-C object pointers is strongly discouraged.
解决办法:
某数字& 0x1的时候是代表要取最低位是否为1,改成了 if(JK_EXPECT_F(((NSUInteger)object)%2))即可。
17.警告:Implicit conversion loses integer precision: 'unsigned long' to 'CC_LONG' (aka 'unsigned int').
解决办法:CC_MD5(str,strlen(str), r);,改成了 CC_MD5(str, (CC_LONG)strlen(str), r);即可。
18. 警告:error: failed to launch '/private/var/mobile/Applications/xxxxx' -- failed to get the task for process 11140.
解决办法:重启你的开发手机即可,还有一种可能是你的开发者证书与发布证书搞错了,检查在xcode中证书是否一直 。
19. 警告:error: ignoring filxxxxxx/libBaiduMobStat.a, missing required architecture x86_64 in filexxxx/libBaiduMobStat.a
解决办法:
targets -&build setting 下的architectures 设置为 standard architetures(armv7,armv7s) vaild architectures 设置为armv7,armv7s。
20. 警告:error: Directory not found for option '-L/Users/joryoubonxx/BaiduStatistic
解决办法:
删除targets -&build setting 下的library search path不正确的地址,如果还不行,重新添加第三库、clean ,重启Xcode.即可。
遇到相关的警告,一般编译器都会提供解决方案,所以,作为新手,我们应该看懂编译器给我们的提示,这样我们解决问题就会事半功倍。
21. 错误信息:
&_OBJC_CLASS_$ xxxxx &, referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error:linker command failed with exit code 1 (use -v to see invocation)
解决方法:
查看工程,看是不是没有导入相关的框架。或者工程里添加的有相同&.m&,&.h& 文件
22. 错误信息:
Couldn't register dy.CKRiLiText with the bootstrap server. Error:unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.Current language: currently objective-c
解决方法:可能是电脑内存问题引起,重启电脑即可解决。如果重启解决不了问题,那就是你刚刚改动的代码引起的问题。
23. 错误信息:
ios 5是调试正常的,ios 6真机调试的时候,出现如下错误:ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/mac4/Desktop/my desktop/My app/MyApp name 20:09:12 /MyApp name/ZBarSDK/libzbar.a for architecture armv7serror:linker command failed with exit code 1 (use -v to see invocation)
解决方法:在Xcode里,点击相应的Target,然后点Build Settings,找到VALID_ARCHS,看里面的是不是arvm7s,如果不是改成arvm7s就可以了。
24. 错误信息:
error:receiver type 'ViewController' for instance message does not declare a method with selector 'hideSearchBar:' [4]
ViewController 中没有声明一个方法选择'hideSearchBar:
解决方法:
在ViewController .h 中声明一下这个方法 &hideSearchBar&即可。
25. 错误信息:当json从服务端请求时得到的字符串,如果这样写的话,会报错,';' after top level declarator
NSString *ss= @&{&recommend&:&世界末日&,&dogname&:&机器人&}&;
解决方法:
就是,把 &替换成\& 即可。NSString *ss= @&{\&recommend\&:\&世界末日\&,\&dogname\&:\&机器人\&}&;
26. 错误信息:
error: Existing instance variable '_datasource' for property 'datasource' with assign attribute must be __unsafe_unretained
解决方法:
id _ 改为 __unsafe_unretained id _datasource:即可
27. 错误信息:
error: No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).
解决方法:
targets -&build setting 下的 Build Active Architecture Only 设置 NO即可.
31. 警告:
warning:Semantic Issue: Incompatible integer to pointer conversion assigning to 'BOOL *' (aka 'signed char *') from 'BOOL' (aka 'signed char')
解决办法: 检查 BOOL *换为BOOL就可以了,检查是不是多写一个 * 号。
32. Jsonkit中的警告
Direct access to objective-c's isa is deprecated in favor of object_setClass() and object_getClass()
object-&isa 替换为 object_getClass(object)
keyObject-&isa 替换为 object_getClass(keyObject)
(id)keys[idx]-&isa 替换为 object_getClass((id)keys[idx])
format specifies type 'unsigned long' but the argument has type 'nsuinteger' (aka 'unsigned int')
给变量增加(unsigned long)进行类型转换
33. md5(iOS SDK中自带了CommonCrypto
Implicit declaration of function 'CC_MD5' is invalid in C99
[plain] view plaincopy
#define CC_MD5_DIGEST_LENGTH 16
+(NSString *)MD5HashForString:(NSString *)input {
const char *cStr = [input UTF8String];
unsigned char result[CC_MD5_DIGEST_LENGTH];
CC_MD5(cStr, strlen(cStr), result);
return [NSString stringWithFormat: @&%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x&,
result[0], result[1], result[2], result[3],
result[4], result[5], result[6], result[7],
result[8], result[9], result[10], result[11],
result[12], result[13], result[14], result[15]];
引入函数定义的头文件
34. ASIDataDecompressor中的警告
format specifies type'short' but theargument has type 'int'
在+ (SError *)deflateErrorWithCode:(int)code 和 +(NSError *)inflateErrorWithCode:(int)code中
[NSString stringWithFormat:@&Compression of data failed with code %hi&,code] 中
将code改为 (short)code,类型转换
35. Reachability中警告
Using 'stringWithString:' with a literal is redundant
statusString = [NSString stringWithString: @&Not Reachable&];
改为:statusString = @&Not Reachable&;
36. format specifies type 'id' but the argument has type 'const char *'
NSCAssert(NO, @&Unhandled error encountered during SAX parse. msg is %@&, msg);
改为:NSCAssert(NO, @&Unhandled error encountered during SAX parse. msg is %@&, [NSString stringWithUTF8String:msg]);
37. Using 'stringWithString:' with a literal is redundant
改为:self.locationInput.text = @&captured change&;
38. 在项目中设置控件的layer属性时,会发生错误,
&Property 'c' cannot be found in forward class object 'CALayer *&,
这时需要引入#import 。
Error launching remote program: failed to get the task for process
解决方法:
把真机上的软件,删除,然后,clean 一下,重新运行就可以了。
40. iOS真机调试中出现identity(The identity 'iPhone Developer)证书不匹配的问题
提示(null) error: could not read CFBundleIdentifier from Info.plist (null)
新建一个同名工程,拷贝其plist文件,将原工程中的plist文件替换掉即可。
41. &No previous prototype for function& warning
[po]:出现原因:.m里的函数,.h里面没有定义
warning:No previous prototype for function &randomPoint&。如何取消这个警告错误呢?方法尝试了这两种都可以:
1.方法上加修饰符static
2.或者Project-Info -& TARGETS -&Build Settings -& LLVM GCC4.2 - Warnings组 -& Missing Function Prototypes Yes-&No
42. 真机调试的时候,出现 [attachment=49364] 这正常,但是不识别机器的。
解决方法:
把 [attachment=49365] 设置为以上相对应的版本就可以了。
43. 真机调试的时候,出现 ios Broken pipe
解决方法:
:推出xcode
:断开机器(iphone,ipad,ipod)链接
:重启iPhone在联接xcode,就可以了。
44. Property'ssynthesizedgetterfollowsCocoanamingconventionforreturning
[po]:出现原因:是因为苹果在新的编码,不推荐变量以new、copy等关键字开头
解决方法:重命名
45. expected identifier 报错怎么办?
[po]:解决方案: 常见是多了&[]&,仔细检查是否哪里多了[];
46. use of undeclared identifier 错误:
[po]:基本几种情况:
1. .m文件的东西,.h里面没有定义
2. .h里面的东西,缺少头文件 (如:#import &friendsInfo.plist&)

我要回帖

更多关于 2k18扫描出现问题 的文章

 

随机推荐