iOS Error List

来源:互联网 发布:查询的sql语句 编辑:程序博客网 时间:2024/06/04 18:47

cannot create __weak reference in file using manual reference counting

解决1:

设置项目中的build setting -> Apple LLVM7.1 - Language - Objective C -> Weak References in Manual Retain Release YES

解决2:

用__unsafe_unretained 代替weak,但是如果用unsafe_unretained请注意下面的问题。
__unsafe_unretained specifies a reference that does not keep the referenced object alive and is not set to nil when there are no strong references to the object. If the object it references is deallocated, the pointer is left dangling.


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 arm64

这是一个很早以前遇到的问题了,解决方法很简单,
设置项目中的build setting -> All - Combined - 搜索bitcode -> 置为No参考文章


昨天有朋友问我怎么保持蓝牙长连接,就是在后台也不断开,其实这问题百度上一搜一大把啊,谷歌我就不说了。

也说下解决方法吧,只要在info.plist中加入新建一行 Required background modes , 加入下面两项。App shares data using CoreBluetooth 和 App communicates using CoreBluetooth


duplicate symbols for architecture arm64

错误原因可能是:1.有重名的文件。2.import的时候把.h写成.m。
解决方法:前者搜索该文件名,改名或删除均可。后者改成.h即可。


Implicit declaration of function 'SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO' is invalid in C99

错误原因是这样的,我自定义了宏#define SYSTEM_RUNS_IOS7_OR_LATER SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")
解决方法也比较让我惊奇,只要在宏定义的地方添加如下代码即可

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

参考:http://stackoverflow.com/questions/23818606/semantic-issue-implicit-declaration-of-function


Application windows are expected to have a root view controller at the end of application launch

这个报错现在几乎是看不到了,我是下载了httpserver的demo,运行出错。问题就出在rootViewController上。
解决方法,只要设置rootViewController就行了。我将[window addSubview:viewController.view];改成window.rootViewController = viewController;运行ok...


fatal error: could not build module 'Foundation'

今天运行程序的时候突然冒出27个错,而且一看是系统的库,上网查了资料才知道是因为导入了.c的文件而造成的。
解决方法:在.pch文件中加上#ifdef OBJC 和#endif即可。


fatal error: No code signing identities found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “**” were found.

这是我在Archive时遇到的,一看就知道是证书问题,参考了stackoverflow解决了。解决方法:点左上Xcode > 选择Preferences,在Accounts中找到你的Apple ID,然后点击View Details,等待加载,时间会有个1、2分钟的样子,在Provisioning Profiles栏中,download证书,然后问题解决。


fatal error:Missing iOS Distribution signing identity

还是打包上传的时候遇到的,依旧是证书问题,就不说原因了,直接说解决方法:
1.https://developer.apple.com/certificationauthority/AppleWWDRCA.cer下载最新的证书,双击安装
2.到钥匙串中将过期的证书删除即可。(别问我钥匙串在哪,也别说找不到过期的证书^v^)
3.没有第三了,问题已经解决了。


UIWebView手势无效问题

这几天用UIWebView添加上滑下滑手势,发现没有效果,查了资料才发现,UIWebView已经自带手势了,解决问题的方法很简单,添加一个方法:- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer方法实现起来也很简单,我看有的人直接return YES;,但我发现这样并不严谨,应该加个判断,如果是你添加的手势,return YES;否则return NO;
跑一下,OK〜


Undefined symbols for architecture x86_64:

缺少库,缺什么自己补什么就好了。。。


attempt to insert nil object from objects[1]'

插入数组或字典中得值为空,可先进行判断在插入


specifies a non-existent file for the cfbundleexecutable key

這是打包上傳時遇到的,原因是我添加了QQ的分享,只要在info.plist文件中刪除executable file 这个key即可


Failed to chmod user/Library/Developer/CoreSimulator/Devices NO Such File Or directory

這個出現的具體原因我也不是很清楚,在so上也能找到,我重置了一下模擬器就好了( Simulator -> Reset Content and Settings...),當然也有人說重置了沒用。。。,so鏈接:http://stackoverflow.com/questions/40485155/failed-to-chmod-user-library-developer-coresimulator-devices-no-such-file-or-dir


Failed to chmod user/Library/Developer/CoreSimulator/Devices NO Such File Or directory

這個出現的具體原因我也不是很清楚,在so上也能找到,我重置了一下模擬器就好了( Simulator -> Reset Content and Settings...),當然也有人說重置了沒用。。。,so鏈接:http://stackoverflow.com/questions/40485155/failed-to-chmod-user-library-developer-coresimulator-devices-no-such-file-or-dir


This action could not be completed.Try again.(-22421)

錯誤是在上傳項目時出現的,就是說你網絡有問題,繼續重試即可。


PCH was compiled with module cache path

出现这个问题应该是我复制项目所以报错,说路径不同了,只要把but后面的路径里的文件删掉,然后clean项目就好了


This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.

出现这个问题是我在iOS 10的手机上调用系统相机,然后就崩溃了

解决方法:
  1. 在项目中找到info.plist文件,右键点击以 Source Code形式打开
  2. 添加以下键值对,这里以 PhotoLibrary 作为例子
    <key>NSCameraUsageDescription</key>
    <string>此 App 需要您的同意才能读取媒体资料库</string>
  3. 注意,key 是绝对不能写错的,而 value 也就是<string></string>你可以随意写

member access within misaligned address 0x000000000031 for type 'struct ListNode', which requires 8 byte alignment

这是一个c里面的错误,出现的环境是我做一个链表,alloc以后,调用此列表中的属性,然后报错,解决方法也很简单,alloc以后,对链表的每个属性赋值即可(没值就赋NULL)

0 0