iOS---错误合集

本文列举了iOS开发中遇到的一些典型错误,包括bitcode编译问题、真机调试授权警告、CocoaPods安装问题、其他链接器警告、百度地图授权错误以及遍历字典时的异常。并详细介绍了每个问题的解决方法,如修改ENABLE_BITCODE设置、信任开发者应用、调整Other linker flags等。

本文来源地址:www.osjoin.com

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)


问题有点奇怪:

在模拟器上跑得时候没有这个问题,

但是在真机上跑就报这个错误。很是个问题


最后解决办法如下:



把YES---->改成NO

问题解决!!!!


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


解决办法:

打开手机设置


通用--》描述文件--》信任应用


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 cocoapods

       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);

2016-03-03 00:11编辑



7:iOS报错信息如下:

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


终极解决大招解决办法:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

if (![self.presentedViewController isBeingDismissed]) {
                // TODO Something
}
})





更多大招,即时更新,请扫描下面我的二维码哦



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值