美文网首页
iOS 报错、警告集合

iOS 报错、警告集合

作者: YangSHP | 来源:发表于2020-09-12 19:46 被阅读0次

警告:Warning: Attempt to present <UIAlertController: 0x102095720> on <ljNavigationController: 0x10283bc00> whose view is not in the window hierarchy!

解决方法:

-  (UIViewController*)topViewController  {

    return [self topViewControllerWithRootViewController:self.window.rootViewController];

}

-  (UIViewController*)topViewControllerWithRootViewController:(UIViewController*)rootViewController {

    if ([rootViewController isKindOfClass:[UITabBarController class]]) {

        UITabBarController *tabBarController = (UITabBarController *)rootViewController;

        return [self topViewControllerWithRootViewController:tabBarController.selectedViewController];

    } else if ([rootViewController isKindOfClass:[UINavigationController class]]) {

        UINavigationController* navigationController = (UINavigationController*)rootViewController;

        return [self topViewControllerWithRootViewController:navigationController.visibleViewController];

    } else if (rootViewController.presentedViewController) {

        UIViewController* presentedViewController = rootViewController.presentedViewController;

        return [self topViewControllerWithRootViewController:presentedViewController];

    } else {

        return rootViewController;

    }

}


警告:[Common] _BSMachError: port 8207; (os/kern) invalid capability (20) "Unable to insert COPY_SEND"       [Common] _BSMachError: port 8207; (os/kern) invalid name (15) "Unable to deallocate send right"

原因:是自己在alertAction中添加了时间,但是并未采用延时机制。

解决方法:[alertVC addAction:[UIAlertAction actionWithTitle:@"现在升级" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

    //这里添加了多线程,消除警告

        dispatch_after(0.2, dispatch_get_main_queue(), ^{

            NSURL *appStoreUrl = [NSURL URLWithString:[NSString stringWithFormat:kAppStore_APPVersionUrl,APP_ID]];

            [[UIApplication sharedApplication] openURL:appStoreUrl];

            NSLog(@"链接--%@",appStoreUrl);

        });

 }]];


Xcode 真机调试报错:This application's application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed

解决方法:

iPhone上已经装了包标识符一样的 App,删掉再运行

1、Xcode-Window->Devices

2、选中你的设备,在右边的installed Apps中删除这个App

3、重新编绎即可


报错:ld: '/Users/yun/Library/Developer/Xcode/DerivedData/ZSXQ-bqqqiowivvvifvcutgqglfrkrhvc/Build/Products/Debug-iphoneos/AFNetworking/libAFNetworking.a(AFAutoPurgingImageCache.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. file '/Users/yun/Library/Developer/Xcode/DerivedData/ZSXQ-bqqqiowivvvifvcutgqglfrkrhvc/Build/Products/Debug-iphoneos/AFNetworking/libAFNetworking.a' for architecture arm64

错误解析:你添加的SDK(例如:友盟、环信)的二进制库不支持bitcode,但是Xcode默认是支持bitcode的,而且如果支持的话,其中所有的二进制库和framework都必须包含bitcode。

解决方法:


警告:/xxx/Assets.xcassets: A 76x76@2x app icon is required for iPad apps targeting iOS 7.0 and later

解决方法: 如果App支持iPad的话,就需要添加上对应的尺寸;如果只支持iPhone的话:Xcode-Targets-General - Deployment info - Devices 


提示:做混合开发时JS那边返回过来的接口最好中文转义处理一下,否则接口如果带中文的话会报错:Error code 101


报错:dyld: Library not loaded:  /System/Library/Frameworks/UserNotifications.framework/UserNotifications    Referenced from: /var/containers/Bundle/Application/6112ED05-088A-4790-A80A-F05DA0C86C31/ZSXQ.app/ZSXQ      Reason: image not found

解决方案:方案一:1、在Xcode中的Build Phases中的Copy Files项中,将你要引用的framework拖到“Linked Frameworks and Libraries“中【如果已经添加了,跳过这一步】;2、把Build Phases 里Social.framework后边的选项修改成为Optional就可以了 

方案二:在Embedded Binaries点击“+”号,把动态库添加进来


控制台报错:Unbalanced calls to begin/end appearance transitions for <XXX: 0x7fd76290ed70>

原因:控制器之间的跳转动画引起的视图控制器转换显示不协调,没有正确的 开始和结束转换显示


警告:Block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior Insert 'self->'

解决方法:Building Settings ->搜索implicit retain of 'self’,将对应的值改为NO


检查项目中是否存在IDFA的方法:

1. 打开终端cd到要检查的文件的根目录。

2. 执行下列语句:grep -r advertisingIdentifier .(别少了最后那个点号)

手机连接Xcode显示在充电状态但不显示设备时,需要关闭Xcode,再在终端输入命令行:

```sudo pkill usbmuxd```

相关文章

网友评论

      本文标题:iOS 报错、警告集合

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