Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 432|回复: 0

Xcode 升级后,常常遇到的遇到的警告、错误,解决方法

[复制链接]
  • TA的每日心情
    奋斗
    2024-4-6 11:05
  • 签到天数: 748 天

    [LV.9]以坛为家II

    2034

    主题

    2092

    帖子

    70万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    705612
    发表于 2021-6-22 17:19:33 | 显示全部楼层 |阅读模式

     

    从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 <netinet/in.h>

    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,missing required architecture i386 in file 
    解决办法:如果是错误信息的话:
    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 an Objective-C object with unspecified ownership or storage attribute
    解决办法:如果定义了ARC有效,那么必须要有所有者属性的定义;所以代码改成下面这样
    @property (nonatomic, strong, readonly) NSString *ss; 

    11,警告:
    io6一下的xib系统均没有自动选择Use Autolayout, Supporting iOS 5 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 ls https://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.即可。

    遇到相关的警告,一般编译器都会提供解决方案,所以,作为新手,我们应该看懂编译器给我们的提示,这样我们解决问题就会事半功倍。

     

     

     

    处理Xcode 警告 

    除了代码中我们手动加入的

    #Waring  标示 所产生的警告,我们都应该重视。下面是一些警告的处理。

     

    1,方法过期,或 使用新的api  替换方案

      multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock: 

    使用替代方案:

    multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error: 

     http://cocoadocs.org/docsets/AFNetworking/2.1.0/Classes/AFHTTPRequestSerializer.html

     

     

     2,storyboard 不支持的配置 警告

    storyboard: warning: Unsupported Configuration: Plain Style unsupported in a Navigation Item

       原因是你导航栏上的按钮使用了不支持的 style

    see

     

    修改 Plain 为Done   fix waring .

    http://stackoverflow.com/questions/10945859/plain-style-unsupported-in-a-navigation-item-warning-with-my-customized-bar-bu

     

    3,

    1)storyboard: warning: Unsupported Configuration: Scene is unreachable due to lack of entry points and does not have an identifier for runtime access via -instantiateViewControllerWithIdentifier:.

     

    大意是为了在程序中动态访问Scene,需要给其设置一个Storyboard ID,所以给出了警告,解决方法:设置一个Storyboard ID即可. (基本上sb钟的所有VC都需要加,才可消除警告,这里根据自己需求。但也可检查出 sb里面无用的VC,可以干掉)。

     

    http://blog.csdn.net/freedom2028/article/details/8589375

     

    2)storyboard: warning: Unsupported Configuration: Prototype table cells must have reuse identifiers

    必须给sb 里德cell 添加重用标示。(这里看需求。)

     

    3)storyboard: warning: Unsupported Configuration: Segues initiated directly from view controllers must have an identifier for use with -[UIViewController performSegueWithIdentifier:sender:]

    大意:segues 没有设置标识,虽然有连线。这种一般都可以废弃。

     

    或 重新添加标示 结合代码。。

    http://stackoverflow.com/questions/24087250/segue-identifier-error

     

    4) storyboard Frame for "Table View" will be different at run time.

    不全的 约束导致。谨慎修改。可能是代码中需要。

     

    http://stackoverflow.com/questions/18739572/xcode-5-layout-errors-misplaced-view-frame-for-label-will-be-different-at-runt

     

    5) storyboard: warning: Ambiguous Layout: Size and vertical position are ambiguous for "Add Address View".

     

    同上 ,默林两颗的 约束,解放方案同上。

     

     

    4,storyboard: warning: Ambiguous Layout: Horizontal position is ambiguous for "Scroll View".

    自动约束 位置不明确。

     

    补全。

     

     

    5,Images.xcassets

    1), Images.xcassets/: warning: Missing Content: The file "credit_card_light.png" for the image set "credit_card_light" does not exist.

     

    credit_card_light.png 不存在。

     

    but, 明明存在。

     

    show finder 。

     

     

     

    文本编辑,Contents.json .对比其他正常的。

     

    删掉上面的

     

          "filename" : "credit_card_light.png"

       

     

    fix done.

     

    2), Images.xcassets: An iPhone Retina (4-inch) launch image for iOS 7.0 and later is required.

       暂没有处理,解放方案 参考

    http://stackoverflow.com/questions/19732975/adding-ios-7-version-of-iphone-4-inch-launch-image-to-project-breaks-launch-imag

     

     

    6,Apple Mach-O Linker Warning

     1)、Directory not found for option “ –L path”

    尝试项目(目标) - > 构建设置 - > search  path

     

    and clear it。

    http://stackoverflow.com/questions/16644982/apple-mach-o-linker-warning-directory-not-found

     

    2)、Apple Mach-O linker Warning: lgnoring file …

     

     

     

    http://stackoverflow.com/questions/10535678/apple-mach-o-linker-warning

     

     

     

    3), dsymutil warning (armv7) …… .o  unable to open object file

     

     

    DWARF with dSYM file

    设置为 DWARF

    fix done.  这种办法会再 发布是报错。**********************

     

    http://bribser.co.jp/blog/unity-xcode-dsymutil-error-warning/

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-4-26 21:46 , Processed in 0.088174 second(s), 29 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表