zoukankan      html  css  js  c++  java
  • ios 常见问题解决

    一,libxml/HTMLparser.h file not find

    第一种方法:
    点击左边项目的根目录,再点击右边的Build Settings,手工输入文字:“Header search paths”,然后单击(或双击,点击弹出面板下面的“+”号进行添加)“Header search paths ”右边的空白处,输入:/usr/include/libxml2
    第二种方法:
    点击左边项目的根目录,再点击右边的Build Settings,手工输入文字:“Header search paths”,然后单击(或双击,点击弹出面板下面的“+”号进行添加)“ Header search paths ”右边的空白处,输入:${SDK_DIR}/usr/include/libxml2

    二,总是找不到协议:

    第一种方法:没有引入该协议,引入该协议

    第二种方法:重复引入该协议,重复引入的地方删除

    三,启动画面不显示

    1>,图片大小尺寸必须符合规定,把所有的图片导入工程中

    2>,进入工程Images.xcassets文件夹,把图片拖入对应的AppIcon,LaungchImage

    四,ld: library not found for -lcrypto
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    第一种方法:库crypto没有添加进Link Binary With Libraries,添加进去就OK了
    第二种方法:库crypto已经添加进Link Binary With Libraries,把crypto删除再重新添加进去就OK了

     五,Unsupported compiler 'com.apple.compilers.llvmgcc42' selected for architecture 'armv7'  Xcode 5

    Change your compiler for C/C++/ObjectiveC Go to Build Settings->Build OPtions->compiler for C/C++/ObjectiveC; select Default(Apple LLVM5.0)

    六,关于ld: file is universal (2 slices) but does not contain a(n) armv7s slice

    升级了xcode之后,支持iOS6和iPhone5,不过Build项目的时候,出现了标题所示错误提示信息。

    原因是引用的第三方库导致了这个链接错误。

    解决办法有三个,随便哪种都能解决:
    1.升级涉及到的.a文件
    2.在target的Build Settings里面,将Build Active Architecture Only改成YES   (I choose this)
    3.在target的Build Settings里面,找到Valid Architectures,删除其中的armv7s

    所以还是觉得,如果是开源库,直接把源代码包含进项目比较靠谱。

     七,使用第三方插件时,出现contentoffset下移20像素的情况:

    解决方案:在使用第三方控件的viewcontroller的viewDidLoad方法中添加下面的代码即可

    if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
            [self setEdgesForExtendedLayout:UIRectEdgeNone];
        }

    八,提交app的时候会有no indentities were available for signing 提示

    1.在Xcode的Organizer 中可以看到你上传项目的Indetifier

    2,在Provisioning中可以建立的文件和Indetifier保持一致

    3,下载你所建立的Provisioning文件,然后双击

    4,再在Organizer中上传文件就可以了

    5,如果在代码中作了修改,需要重新打包再上传,上传的才会是最新的代码

    九,no matching provisioning profiles found

    1,到Build Settings里面重新选择进入code signing

    2,重新选择profiles

    十. mutating method sent to immutable object'
    从字面上理解:可变的消息发给了不可变的对象。比如NSDictionary类型的对象调用setValue方法.应该把NSDictionary 改成NSMutableDictionary类型。
    十一.Local declaration of 'content' hides instance variable
    一般是函数里面定义的变量和class属性变量重名了。很少有和系统变量重名的情况
    十二.unrecognized selector sent to instance
    大部分情况下是因为对象被提前release了,在不希望他release的情况下,指针还在,对象已经不在了
    很多时候,是因为init初始化函数中,对属性赋值没有使用self.foo赋值,而是直接对foo赋值,导致属性对象没有retain(心里以为retain了),而提前释放。
    十三.使用ASIHTTPRequest编译不通过
    原因是一些类库没有加进去。把这些库加进去CFNetwork, SystemConfiguration, MobileCoreServices, and libz.dylib
    十四.添加在UIView中的UIButton   单击不起作用
    原因是UIbutton的frame超出了UIView的frame范围。事实上UIView并没有设置frame,设置完后( 范围一定要在UIButton之外),UIButton单击就可以了
    十五.当使用presentViewController和dismissPresentViewController时,如果报这个错 : while  presentation is in progress

    修改方法为[mainView dismissModalViewControllerAnimated:NO];  将参数Animated改为NO;如果报这个错while a presentation or dismiss is in progress,试试这样

     if (![[mainView modalViewController] isBeingDismissed]) {
            [mainView dismissModalViewControllerAnimated:NO];
        }

    十六.调用系统相册的时候,非常容易出现内存警告,加入绿色代码就会好点
            UIImagePickerController * picker = [[UIImagePickerController alloc]init];
            picker.delegate = self;
            picker.allowsEditing = NO;  //是否可编辑
            picker.videoQuality=UIImagePickerControllerQualityTypeLow;
            //摄像头
            picker.sourceType = UIImagePickerControllerSourceTypeCamera;
            [self presentModalViewController:picker animated:YES];
            [picker release];

    十七.ios开发者都遇见过得错误:EXC_BAD_ACCESS 。这个和第二个比较类似。通常的调试方法就是加入NSZombieEnabled变量,加入方法自行百度。

    并且开发过程中使用[[NSNotificationCenterdefaultCenter]

    来发布本地消息,这个也经常会出现EXC_BAD_ACCESS错误。这个时候只需要在你的view活着viewControllers的dealloc的方法里面加入

    [[NSNotificationCenterdefaultCenter]removeObserver:selfname:@"yourNotification"object:nil];就ok了

    十八.遇见一个蛋疼的问题"linker command failed with exit code 1 (use -v to see invocation)" 。

    翻遍了找不到原因。然后还有这样的警告duplicate symbol _OBJC_CLASS 。原来是在导入某个类的时候导入.m文件,而不是.h文件

    十九:clang failed with exit code 254

    检测代码中 是否 有 NSLog 打印了 返回 void 的值.

    二十:Verify exit code of build task with internal identifier 'CopyPNGFile 123.png'

    加载中...

    一:将出错的png,用PhotoShZ喎�"http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcNbY0MLXqru70ru0ziwgIMjnuftQaG90b1Nob3C08rK7v6osuMS689e6zqpKcGcgytTK1C4g16q7u8qxLMfryrnTwyA6PHN0cm9uZz605rSizqpXZWK78snosbjL+cq508O1xCYjMjY2ODQ7yr08L3N0cm9uZz4mIzI2Njg0O8q916q7u7PJPHN0cm9uZz4gUE5HLTI0PC9zdHJvbmc+1eLR+bXEzbzGrLTz0KGxyL3Pus/KyjwvcD4KPHA+Cjxicj4KPC9wPgo8cD4KPHN0cm9uZz4zOjwvc3Ryb25nPjwvcD4KPHA+CjxpbWcgc3JjPQ=="http://www.2cto.com/uploadfile/2014/0509/20140509112551421.png" alt="">

    一:确定静态库中是否有自定义的类文件,如果一个也没有,就会出现这种错误,这也是为什么新建的静态库都包含一个默认的类.

    二十一: _OBJC_CLASS_$_UIMainKpiXML", referenced from:

    1:检测类文件是否已经指定了Project Target

    加载中...

    2:检测类文件是否在Bulid Phases 中的 Compile Source 是否包含了这个类文件

    加载中...

    以上两步都检查完成以后,如果编译还报错误,请尝试彻底关闭XCode 再次编译试试.

    二十二: for architecture armv7s


    以下摘自: http://stackoverflow.com/questions/12570116/what-is-the-difference-between-arm7-and-arm7s

    Yes you are right about armv7s is about the iPhone 5. Here some summary info I found on the web:

    • ARMv6 ISA (used by the ARM11 core in the iPhone 2G and iPhone 3G)
    • ARMv7 (used by modern ARM cores, iPhone 3GS, iPhone 4 and 4S)
    • ARMv7s (new A6 SoC for iPhone 5).

      注:错误含义表示 指定的framework 不支持对 armv7s 的支持, 也就不支持搭载A6处理器的iPhone 5.

      如果在编译framework或者静态库的工程中依旧编译时,可能是以下设置导致,设置为NO即可

    二十三: Local declaration of "' hides instance variable

    私有变量与属性变量同名所致

    二十四:Instance variable '' accessed in class method

    加载中...

    1:在静态方法不能使用到类的属性变量,否则就报上面的错误

    二十五:ld: symbol(s) not found for architecture i386

    加载中...

    1:里面意思说:"_stroyboard" 这个属性在目标类中 根本就没声明!

    那就声明一下咯? 注:XCode4.5 会默认声明了,但是只是针对自定义类,系统类还没有. 所以,小心

     @synthesize storyboard;

    二十六:PerformSelector may cause a leak because its selector is unknow

    通过如下代码解决产生的编译器警告

    #pragma clang diagnostic push

    #pragma clang diagnostic ignored "-Warc-performSelector-leaks"

    [self performSelector:nextView];

    #pragma clang diagnostic pop
    来源:(http://www.ooso.net/archives/620)

    二十七:unable to open executable

    1:检测同一个静态库或工程中是否有两个或以上的想同类文件存在

    2:删除模拟器中的应用,删除DerivedData文件夹 重新启动XCode.

    二十八: Property's synthesized getter follows Cocoa naming convention for returning 'owned' objects

    不要在头文件声明变量命名是以new copy开头

    参考:http://kongbei888.blog.163.com/blog/static/24326613201261902510652/

    二十九:ld: file not found:

    1:指向的静态库没有找到



    三十: _utf8_countTrailBytes

    add library libicucore.dylib

    三十一:Stray "@" in program

    工程使用的编译器版本过低所致. 修改编译器版本至最新版本,如下图:

    加载中...

    参考:http://stackoverflow.com/questions/12821938/stray-in-program-with-nsdictionary-definition

    三十二.解决真机调试iPad Air设备时的错误:architecture not supported的办法

    1.将Build Settings 中Architectures ——> Valid Architectures的arm64删掉,只留armv7、armv7s

    2.同上,将Architectures ——>Architectures改为 $(ARHS_STANDARD)armv7,armv7s

    3.把Build Active Architecture Only 改为NO

    4.编译即可

    三十三.编译时出现:Not supported ARM architecture

    解决办法:在./configure 时加入 -D__ARM_ARCH_5TEJ__

    三十四.Couldn"t register xxx.xx.xx with the bootstrap server. Error: unknown error code.
    This generally means that another instance of this process was already running or is hung in the debugger.
    每个在xcode下用ios模拟器做开发的开发者都应该会遇到过上面所示的错误,目前找到最行之有效的解决办法是重启手机。不行了也顺便把电脑重启下。 建议以后记得stop就行了 不要正运行着就直接卸载了程序

    三十五.duplicate symbol _protobuf_c buffer_simple_append in ...错误解决

     选中工程,target,切换到buildsetting标签,定位到other link flag,

    输入: 去除-all_load,即可

    三十六.ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architectur

    错误:ld: symbol dyld_stub_binding_helper not found, normally in crt1.o/dylib1.o/bundle1.o for architecture i386

    原因:不支持低版本的系统如3.0

    解决:Deployment Target was 3.0. Changing it to 4.3 fixed it.

    三十七.当一个tableViewCell被选中的时候,改变一个button的title,这个button有背景图片,改变title不成功

    把该button的selected设为NO

    三十八.CUICatalog: Invalid asset name supplied: , or invalid scale factor: 2.000000

    这个提示的意思是说你用了这个方法

    [UIImage imageNamed:name];但是这个name却是空的,所以就报了这个错了。

    解决方法,在项目中搜索[UIImage imageNamed:,然后打印看看所谓的name是否为空。找到后替换。

    三十九.XCode开发遇到的“Could not inspect the application package”解决方案

    出现这种情况的原因是:项目里含有 Resources 文件夹。解决方案:

    1>在项目里把这个 Resources 文件夹 改为别的名字(不要在项目里改文件夹的名字,这是伪改,要进入工程文件夹再改 Resources 名字),再重新引入这个文件夹

    2>按住 option 键 ,点击 Xcode 的product 菜单,选中 Clean Build Folder ,然后确定 clean 就OK了

    四十.Xcode has encountered an unexpected error (0xC002)

    Xcode has encountered an unexpected error (0xC002)
    No such file or directory, at ‘/SourceCache/DTDeviceKit/DTDeviceKit-867/DTDeviceKit/DTDeviceKit_Utilities.m:864’
    解决方法
    
    cd ~/Library/Developer/Xcode/iOS DeviceSupport/4.2.1 (8C148)/Symbols/System/Library/Caches/com.apple.dyld/ 
    
    touch .copied_dyld_shared_cache_armv6 
    
    touch .processed_dyld_shared_cache_armv6 
    
    touch dyld_shared_cache_armv6
    
    有些可能是 
    touch .copied_dyld_shared_cache_armv6
    touch .processed_dyld_shared_cache_armv6 
    touch dyld_shared_cache_armv6

    四十一.An error was encountered while running(Domain=LaunchSerivcesError, Code=0)

    解决方案:重置模拟器

     四十二.Undefined symbols for architecture i386:
      "_NSFileTypeForHFSTypeCode", referenced from:
          -[FMDatabase(FMDatabaseAdditions) applicationIDString] in FMDatabaseAdditions.o
      "_NSHFSTypeCodeFromFileType", referenced from:
          -[FMDatabase(FMDatabaseAdditions) setApplicationIDString:] in FMDatabaseAdditions.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    解决办法:把FMDatabase文件删除了,再重新导入所有的文件

    四十三.fatal error: malformed or corrupted AST file: 'Unable to load module "/Users/xxx/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP/Darwin.pcm": file not found' note: after modifying system headers, please delete the module cache at '/Users/me/Library/Developer/Xcode/DerivedData/ModuleCache/XYZYIE6ZV0OP' 1 error generated.

     解决办法:

    只需要清除继承数据文件夹即可。具体操作为:进入XCode的Window,选择Organizer->Projects,然后选择出现问题的 project ,点击delete button删除Derived data.

    重新编译项目,即可。

    四十四.Command /usr/bin/codesign failed with exit code 1

    进入xcode 的偏好设置 -》Account如下图

    点击第二张图右下角的刷新按钮,重新编译打包,就OK了

    四十四.the ipa is invalid.it does not include a payload directory

    需要在info-plist 文件中 添加或者修改 LSRequiresIPhoneOS value 为 YES

    四十四.iOS9 beta 请求出现App Transport Security has blocked a cleartext HTTP (http://)

    错误描述:

    App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app‘s Info.plist file.

    在iOS9 beta中,苹果将原http协议改成了https协议,使用 TLS1.2 SSL加密请求数据。

    解决方法:

    在info.plist 加入key

    <key>NSAppTransportSecurity</key>
    <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    </dict>

      

    四十五.Could not find Developer Disk Image

    真机系统太高,Xcode支持不到这个系统,要有这个系统版本的镜像文件 ,/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport ,会列出支持的设备,然后在网上下载对应的文件

    四十六.UICollectionView 会在APP再次打开时下沉64像素

    方案一:在Storyboard中取消勾选Controller的Adjust Scroll View Insets。或者  

     self.automaticallyAdjustsScrollViewInsets = NO;

    方案二:

    self.edgesForExtendedLayout = UIRectEdgeNone;

    四十六.dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib
    Referenced from: /var/mobile/Containers/Bundle/Application/AC4B5FD7-43B3-4743-9682-60A026C5CAE2/NewFoodiPad.app/NewFoodiPad

    rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"

    rm -rf ~/Library/Developer/Xcode/DerivedData

    rm -rf ~/Library/Caches/com.apple.dt.Xcode

    四十七.swift项目 ios8系统 SVProgressHud crash在 self.hudView.motionEffects = @[];

    self.hudView.motionEffects = [NSArray array];

    四十八.swift项目 ios8  dyld: Symbol not found: ___NSArray0__

    dyld: Symbol not found: ___NSArray0__
      Referenced from: /private/var/mobile/Containers/Bundle/Application/5C6F5D69-5D14-4C07-BEA4-F410C18C66CC/DGBao.app/DGBao
      Expected in: /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
     in /private/var/mobile/Containers/Bundle/Application/5C6F5D69-5D14-4C07-BEA4-F410C18C66CC/DGBao.app/DGBao
    

    解决办法:

     

    改为 optinal

    四十九.The maximum number of apps for free development profiles has been reached.

    免费应用程序调试最大限度
    苹果免费App ID只能运行2个应用程序,当调试第三个的时候就会报这个错误,我们必须把之前的应用程序删除,就可以调试新的了


    五十.“(null)” is of a model that is not supported by this version of Xcode.
    今天真机运行碰见了这个问题(“(null)” is of a model that is not supported by this version of Xcode. Ple),发现将XCode重启后就可以真机运行了,碰见这个问题的朋友可以试下

  • 相关阅读:
    多个断言连续执行pytest-assume && try except assert 错误思路
    allure钩子函数 && selenium 截图的四种方式 && allure集成错误截图报告
    --clean-alluredir && 用例优先级@allure.severity
    参数化(parametrize)allure用例描述的两种方式 第二种重点
    allure step 编写测试用例的两种方式
    allure与测试用例的故事 feature story title issue
    windows安装jenkins并集成allure 附jenkins插件安装缓慢问题
    git 使用开发 pycharm远程提交到仓库
    Java 集合框架
    Java 迭代器iterator
  • 原文地址:https://www.cnblogs.com/shidaying/p/3651443.html
Copyright © 2011-2022 走看看