iOS---错误合集

作者: 洲洲哥 | 来源:发表于2016-04-07 17:56 被阅读1208次

本文首发地址

iOS调用系统相机出现如下提示

Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.

你会发现在ios10以下是没问题的。但是在ios10以上 就会闪退。
原因很简单,为了保护安全。
解决办法就是:
保全期间还是全部加上

Privacy - Camera Usage Description:您可以使用相机更方便上传图片
Privacy - Location When In Use Usage Description:打开定位,更准确定位
Privacy - Photo Library Usage Description:您可以使用相册中的照片、将相片保存

1:最近做微信登录在真机上调试的时候遇见一个问题

ld: '/Users/hzbj/Desktop/工程/20151118/weixinOAuth/weixinOAuth/libWeChatSDK.a(WXApiObject.o)' 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 arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

问题有点奇怪:
在模拟器上跑得时候没有这个问题,
但是在真机上跑就报这个错误。很是个问题
解决办法如下:


20151119153934107.jpeg
把YES---->改成NO
问题解决!!!!

2:在真机调试的时候会遇见一个弹框“使用开发者“iphone developer”的应用。您可以在“设置”中允许使用这些应用”

20151128110849274.jpeg

解决办法

打开手机设置
通用--》描述文件--》信任应用

3:安装cocapods的时候 报错

错误代码如下

ERROR:  While executing gem ... (Errno::EPERM)  
    Operation not permitted - /usr/bin/xcodeproj

解决办法

把终端的输入 安装命令  
sudo gem install cocoa pods

改成如下命令即可
 sudo gem install -n /usr/local/bin cocoa pods

4:安装pod install 的时候 提示如下提醒,但不是错误,看这费劲

解决办法

- Use the `$(inherited)` flag, or
 - Remove the build settings from the target.

虽然对项目编译没什么影响,但是看着还是挺不舒服的.解决办法就是
找到工程的 targets 点击工程名  Build Settings -> Other linker flags -> 添加 $(inherited)

5:百度地图 授权失败 onGetPermissionState 230

解决办法

原因是你的bundle id 和你百度地图的绑定的id不一致 

6: Collection <__NSDictionaryM: 0x7fe1d283cf30> was mutated while being enumerated

我今天在遍历字典的时候,又修改他的数据,结果只能循环一次。然后就出现上面的原因。
分析错误原因如下:
当程序出现这个提示的时候,是因为你同时遍历你的数组,有同时修改你数组里的数据,导致崩溃
解决办法两种
1:搞一个和你要遍历的数组一样的数组出来

 /* 
     // 便利数组A 操作数组B
    NSMutableDictionary * mutableDictionary = [[NSMutableDictionary alloc] initWithDictionary:parameters];
    for (NSString * key in parameters) {
        [mutableDictionary setObject:@"ddddddd" forKey:key];
    }
    NSLog(@"-----------------%@",mutableDictionary);

2:用系统自带的遍历,原理也差不多

NSMutableDictionary * tempDictionary = [[NSMutableDictionary alloc] init];
    
    [parameters enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
        
        NSLog(@"key---%@",obj);
        [tempDictionary setObject:@"dddddddd" forKey:key];
        
        
    }];
    
    NSLog(@"==========%@",tempDictionary);

7:iOS报错信息如下:

Warning: Attempt to dismiss from view controller <UINavigationController: 0xb359a20> while a presentation or dismiss is in progress

出现这个的原因是,你模态跳出的界面还没有彻底的回归,就在当前的基础上又弹出新的VC
终极解决大招解决办法:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{  
  
if (![self.presentedViewController isBeingDismissed]) {  
                // TODO Something  
}  
})

8:iOS报错信息如下

libmp3lame.a(lame.o)' 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 arm64
clang: error:

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

第一次看见这个错误就很费解,关键是下面这个话

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

知道是在大多数的情况下,是有第三方的包重复引用。但是具体的又不知道在哪里下手。仔细一看这句话

You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE),

查看百度知道

说的是bitcode是被编译程序的一种中间形式的代码。
包含bitcode配置的程序将会在App store上被编译和链接。
bitcode允许苹果在后期重新优化程序的二进制文件,
而不需要重新提交一个新的版本到App store上。

【官方解释】

当提交程序到App store上时,Xcode会将程序编译为一个中间表现形式(bitcode)。
然后App store会再将这个botcode编译为可执行的64位或32位程序。

废话不多说 看解决办法
项目工程名--->TARGETS->Build setting ->Build options ->Enable BitCode 设置为NO

9D6174B9-470F-4A12-A5B2-E5CE97BE5EE5.png

如有问题可添加我的QQ:1290925041
还可添加QQ群:234812704(洲洲哥学院)
欢迎各位一块学习,提高逼格!
也可以添加洲洲哥的微信公众号
更多大招,即时更新,请扫描下面我的二维码哦

洲洲哥的OSjoin.jpg

相关文章

  • iOS---错误合集

    本文首发地址 iOS调用系统相机出现如下提示 你会发现在ios10以下是没问题的。但是在ios10以上 就会闪退...

  • 错误合集

    原因:客户端在调用服务时会将参数自动序列化,服务提供方在反序列化时无法以最有效的方式反序列话,就会产生如上警告。但...

  • 用Application Loader 上传的时候报错

    iOS---用Application Loader 上传的时候报错No suitable application ...

  • ReactNative错误合集

    ScrollView设置contentOffset无效的的问题 问题描述:最近把公司项目从0.43版本升级到0.4...

  • 2016错误合集

    5.4 送2单外卖,一单是拖了快一个小时,说不管多久都会等,另一单标明“请尽快”,坚哥说先说前者,我就纳闷了“都说...

  • 各种错误合集

    ubuntu Apache2 .htaccess: Invalid command 'RewriteEngine'...

  • vue错误合集

    1、Invalid handler for event "click": got undefined 点击方法未定...

  • Mybatis错误合集

    1、 错误:mybatis generator自动生成代码时User对象生成多个 原因:如果您使用的是Connec...

  • MySQL错误合集

    此为记录在mysql使用过程中,遇到的一些错误 1. Mysql查询报错:The total number of ...

  • iOS错误合集

    一. flutter、VS code ios1.pod install报错:The 'Pods-Runne...

网友评论

    本文标题:iOS---错误合集

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