zoukankan      html  css  js  c++  java
  • 开发工程中遇到的BUG

    0

    Xcode7在创建项目的时候勾选此选项,
    Snip20151008_2.png
    创建出来的项目会报如下错误警告:
    "Couldn't communicate with a helper application",
    Snip20151008_4.png

    我重启Xcode然后编译代码,通过Xcode自带commit提交,
    Snip20151008_5.png

    还是会出现下面的错误警告
    Snip20151008_6.png
    "Couldn't communicate with a helper application",
    我就去了,helper application是什么啊?????
    实在搞不懂了????
    是我打开的方式不对吗?

    1、Couldn’t communicate with a helper application in Xcode 7

    问题一:

    Couldn't communicate with a helper application in Xcode 7

    翻译:不能与助手应用程序通信在Xcode7中(helper ->指的是git)

    解决:

    终端输入:

    Xcrun git config --global user.email 邮箱

    xcrun git config --global user.name gitHub的你的名字


    2、网上下载的Demo运行时报错

    问题二:

    网上下载的Demo运行时报错

    ld:library not find for -lpods-xxxxxx

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

    解决:

    1. 首先查看本地是否安装cocoapods, 如果没安装请先安装pod,

    2. 如果安装cocoapods,请打开终端,cd ~/到你工程文件夹(或者将文件夹直接拖到终端中)

    3. 使用命令行 pop install --verbose --no-repo-update

    4. 请使用xxx.xcworkspace打开工程


    3、Xcode升级导致插件失效

    问题三:

    Xcode升级导致插件失效

    解决:

    1. 在终端输入defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID查看xcode的UUID。

    2. 找到xcode插件所在的目录:~/Library/Application Support/Developer/Shared/Xcode/Plug-ins。在plist文件中找到DVTPlugInCompatibilityUUIDs, 点击加号, 添加一个item, 对应的value值为输入刚才终端中获得的UUID,cmd + s保存。

    3. 重启Xcode,弹出的对话框中选择Load Bundle

    4. 如果误点Skip Bundle,找到该插件安装路径下,继续打开在 info.plist 删除与命令端里面同样的UUID号,一般都是会在最后一行,自己添加的那一行也要删除掉。保存之后重启Xcode,再次重复上面的步奏。在重启就再次出现了插件提示


    4、Unable to add app id because the '10' APP ID limit in '7'days has been exceeded

    问题四:

    Unable to add app id because the '10' APP ID limit in '7'days has been exceeded

    翻译:无法添加应用程序id,因为“10”应用程序id已经超过限制(7日)

    解决:

    此问题针对于真机测试:

    在developer center 重新设置一遍自己的APP ID 然后将APP ID 作为 Bundle ID添加到工程

    免证书进行xcode真机调试方法:http://www.jianshu.com/p/3b2be6454462


    5、Undefined symbols for architecture armv7:ld: symbol(s) not found for architecture armv7

    问题五:

    5.1: Undefined symbols for architecture armv7:

    "_compress2", referenced from:

    +[UMANDeflated deflatedDataPrefixedWith:level:source:] in libMobClickLibrary.a(UMDeflated.o)

    ld: symbol(s) not found for architecture armv7

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

    解决:

    检查项目友盟这个库的依赖呀.确认库已经导入而且在链接的二进制库里面.(就是build phases里面).

    检查是否某些文件路径未加入进来或者写错了

    把xx文件库+进来

    5.2: *** 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 armv7

    解决:友盟的二进制库不支持bitcode.而Xcode默认是要支持bitcode的,而且如果支持的话,其中所有的二进制库和framework都必须包含bitcode(工程build setting -> build options ->Enable Bitcode设置为关闭)


    6、installation failed invalid argument

    问题6

     installation failed invalid argument

    翻译:安装失败,参数非法

    原因:我把Bundle indentifier 置为空了!

    解决1:

    1、Quit Xcode

    2、Clean out ~/Library/Developer/Xcode/DerivedData manually

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

    4、iOS Simulator > Reset Content and Settings

    解决2:随便添加一个Bundle indentifier


    7、看不见控件是什么原因

    原因:

    1、根本没有创建实例化这个控件

    2、没有设置尺寸

    3、控件的颜色跟父控件的背景色一样

    4、透明度alpha<=0.01

    5、hidden = YES

    6、没有添加到父控件中

    7、被其他控件挡住了

    8、位置不对

    9、父控件发生了以上变化

    10、特殊情况

    *UIIamgeView没有设置image属性,或者设置的图片名不对

    *UILabel没有设置文字,或者文字颜色和父控件的背景色一样

    *UITextField没有设置文字,或者没有设置边框样式borderStyle

    *UIPageControl没有设置总页数,不会显示小圆点

    *UIButton内部imageView和titleLabel的frame被篡改了,或者没有内容

    建议:

    1、最好设置背景色和尺寸

    2、控件的颜色尽量不要跟父控件的背景色一样


    8、在Archive项目时,出现了“Your build settings specify a provisioning profile with the UUID “”, however, no such provisioning profile was found”的出错。一直提示指定UUID的provisioning profile找不到

    问题8

    在Archive项目时,出现了“Your build settings specify a provisioning profile with the UUID “”, however, no such provisioning profile was found”的出错。一直提示指定UUID的provisioning profile找不到

    解决:

    1.找到项目中的**.xcodeproj文件,点击右键,show package contents(打开包内容)。

    2.打开后找到project.pbxproj文件,用文本编辑器打开。其实就是右键,点击open就好了。

    3.打开这个文件后,按command+F,在这个文件中查找“PROVISIONING_PROFILE",找到和这个“

    PROVISIONING_PROFILE = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";

    "PROVISIONING_PROFILE[sdk=iphoneos*]" = "487F3EAC-05FB-4A2A-9EA0-31F1F35760EB";”类似的都删除。

    4.然后保存文件,重新打开项目。xcode会提示你重新下载安装provisioning profile文件。下载后安装上就可以。


    9、真机运行时,提示The executable was signed with invalid entitlements.

    1.在工程中添加文件new file,选择plist文件,添加后名称为Entitlements.plist。

    2.点击Entitlements.plist进行编辑,删除所有Root下的Key,然后添加一个Boolean类型,名称为get-task-allow的Key,Value为YES。

    3.在Targets中的Build Setting选项卡中的Code Signing Entitlements的值设为Entitlements.plist,重新Build即可解决。


    10、the file couldn't be opened because you don't have permission to view it

    解决方法一:changed the value of the "Compiler for C/C++/Objective-C" to Default Compiler.

    解决方法二:Project---Build Setting中 修改这一项,变成Default Compiler(Apple LLVM 6.0)

    解决方法三:command + shift + k

    解决方法四:xcode页面command +','调出设置页面点击最后一个'Location选项',点击第一个小箭头 会跳转到一个文件夹-->>删除文件夹-->>command+shift+K Claen一下-->> command + R


    11、error: [__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]

    @interface ...

    @property (nonatomic, readonly, strong) NSMutableArray *videos;

    @end

    @implementation ...

    //懒加载初始化

    - (id)init {

    self = [super init];

    if (self) {

    _videos = [NSMutableArray new];

    }

    return self;

    }


    12、UIWebView 加载https站点出现NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9843)

    http://www.itnose.net/detail/6042798.html


    13、在使用百度地图时,使用的时候下面一句报错了~BMKMapPoint *pionts = new BMKMapPoint[index];用下面这句也报错    delete []points;

    解决方案:将把文件后缀从m改成了mm。

    分析:变态的百度静态库中采用ObjectC++实现,以上两句时ObjectC++的特性。如果把文件后缀改为mm,则xcode会用ObjectC++的方式来编译文件。


    14、setValue:forUndefinedKey: this class is not key value coding-compliant for the key

    要设置tableviewCell的customClass,而不是file‘s owner的custom class


    15、_BSMachError: (os/kern) invalid capability (20)

    _BSMachError: (os/kern) invalid name (15)

    原因:是自己在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);

    });

    }]];


    16、command/usr/bin/codesign failed with exit code 1- code sign error

    http://stackoverflow.com/questions/29242485/command-usr-bin-codesign-failed-with-exit-code-1-code-sign-error


    17、ld: 4 duplicate symbols for architecture x86_64

    问题  ld: 4 duplicate symbols for architecture x86_64

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

    解决: "duplicate"和"symbols"。duplicate的中文意思是“重复的、复制的”,而symbols的意思是“符号”。也就是可能在你工程中引入了重复的东西。

    第一种情况:在工程中重复导入了某一个类或文件,这一般出现在你添加第三方库的时候比较多,在不知道的情况下又导入了一次相同的类。

    第二种情况:工程中在#import引入头文件的时候,将#import "XXX.h" 写成了#import "XXX.m"。错误的引入.m头文件


    18、layoutSubviews什么时候调用

    layoutSubviews在以下情况下会被调用:

    1、init初始化不会触发layoutSubviews

    2、addSubview会触发layoutSubviews

    3、设置view的Frame会触发layoutSubviews,当然前提是frame的值设置前后发生了变化

    4、滚动一个UIScrollView会触发layoutSubviews

    5、旋转Screen会触发父UIView上的layoutSubviews事件

    6、改变一个UIView大小的时候也会触发父UIView上的layoutSubviews事件


    19、-[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]

    字典不能传空值


    20、-[__NSDictionaryM objectAtIndexedSubscript:]: unrecognized selector sent

    __NSDictionaryM  无法将值传到下标索引对象,就是数组越界,并且不是数组,而是字典,所以,遇到这种crash

    两种情况:

    1.首先看看你 indexPath.row 用的有没有问题;

    2.看看你请求下来的数据类型对不对。

    21、Error Domain=kCLErrorDomain Code=2 “The operation couldn’t be completed. (kCLErrorDomain error 2.)”

    网络错误,CLGeocoder需要一个网络连接,不应该每分钟发送多个地理编码请求.geocoder断绝希望保护自己免受被请求从一个设备过载。你只是必须限制你发送的请求数

    22、NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: NSBundle

    方法一:

    1. Right Click - Delete and Remove Reference

    2. 重新引入文件

    方法二:重命名该文件

    23、objc_msgSend()报错Too many arguments to function call ,expected 0,have3

    Build Setting--> Apple LLVM  - Preprocessing--> Enable Strict Checking of objc_msgSend Calls  改为 NO

    24、void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNewWindowAction:request:

    - (void)dealloc {

    _webview.delegate = nil;

    [_webview stopLoading];

    }

    25、too many errors emitted, stopping now解决办法 / 莫名其妙的错误:could not build module ‘Foundation’

    让整个pch文件的内容在这两行代码以内

    #ifdef __OBJC__

    #endif

    26、Host is down -sendto(2) '192.168.1.2' port 53

    看看自己的网络吧骚年,DNS和路由器IP不对应。

    27、[NSISObjectiveLinearExpression coefficientForVariable:]: unrecognized selector sent to instance 0x1cd93850

    - (void) viewWillDisappear: (BOOL) animated {

    [super viewWillDisappear: animated];

    // Force any text fields that might be being edited to end so the text is stored

    [self.view.window endEditing: YES];

    }

    。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

    持续更新中。。。

    。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。



    作者:JJ骏
    链接:https://www.jianshu.com/p/39bb64d8397f
    來源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
  • 相关阅读:
    10.23
    四则运算(1)
    10.12
    10.22
    今日总结
    Java自学
    Java自学
    Java自学
    Java自学
    Java自学
  • 原文地址:https://www.cnblogs.com/sundaysgarden/p/9094775.html
Copyright © 2011-2022 走看看