iOS / Xcode错误收集(持續)
原因是:因为你的证书在上一次安装到现在安装失败这段时间里证书肯定被重置过,那么两次的签名就不一样了,而你的Bundle identifier ID又是同一个,所以你这次安装会失败。
-
解决方法一(自已的总结):
把手机上相应的APP删除,删除后,xcode clean下,然后重新运行,是不是成功了! -
解决方法二(网上的方法):
在stackoverflow上查找答案,有人说需要撤销原来的inHouse证书,然后重新制作新的证书和provisioning profile。
于是登录Portal,重新制作证书和Provisioning Profile。
将代码重新签名,再次打包。
程序正常启动。
Command /Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
解决方法:Project Settings > Under "Targets", select your project > Build Phases > open "Compile Sources" and "Copy Bundle Resources". Check if any files are listed in red color. If so , just delete it. Then clean and run.
Xcode8导入框架出现"Use Legacy Swift Language Version"的报错
具体解决办法:
-
方法一:
1.点击项目中的Pods。
2.选中你的框架,此处我导入的是ReactiveCocoa框架。
3.选中Build Settings,然后在右边搜索框输入:swift
4.找到Swift Compiler - Search Paths 下的 Use Legacy Swift Language Version:把后面的改成YES即可。 -
方法二:
勾选你想转换的Swift的版本。然后点击Next。
直接点击update。特别强调的一点,转换过程中,会出现大量的报错,不用担心,转换完毕直接build是会通过的
Your build settings specify a provisioning profile with the UUID‘XXX’, however, no such provisioning profile was found. Xcode can resolve this issue by downloading a new provisioning profile from the Member Center.
解决方法:关闭项目,找到项目文件XXXX.xcodeproj,在文件上点击右键,选择“显示包内容”(Show Package Contents)。会新打开一个Finder。
在新打开的Finder中找到project.pbxproj,并且打开,找到所有包含报错的UUID‘XXX’的行(包含UUID后面的一串数字的行,可能不包含"UUID"),整行删除,保存,重新启动项目,再编译,就OK了。
CrashLog分析崩溃
- 使用Xcode查找crash log并解析:
(product -> archieve->找到.app和.dSYM,并与.crash放到同一个文件夹里)
找到.dSYM的位置 - 配置:Build Settings------>Debug information format ----选DWARF with dSYM File
- 路径:“ 使用Finder前往路径~/Library/Developer/Xcode/Archives/,可以看到日期目录,目录下有后缀名为xcarchive的文件,选中该文件,右键菜单选择“显示包内容”,可以看到一个dsYMs目录
- 将目录中的XXX.app.dsYM文件拷出来,后面分析会用到。
- 如dSYM.app分析工具,可以百度搜索下载使用
在把项目打包成ipa包时,出现以下错误:
While reading /Users/apple/Downloads/kongyu/6_26Shopping2 2/6_26Shopping2/Default@2x.png pngcrush caught libpng error:台\216\347\217ֵ\232@A\347\217\320Command /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/copypng emitted errors but did not return a nonzero exit code to indicate failure
解决办法:
- project------>Build Settings ---->Compress PNG files 将其设置为NO
- 深度清理工程(shift + option + command + k),清理完成后再编译。
使用xib、autolayout 创建的界面,崩溃,报如下信息:
*** Assertion failure in -[NSLayoutConstraint constant], /SourceCache/Foundation/Foundation-1144.17/Layout.subproj/NSLayoutConstraint.m:643
或者:
Assertion failure in -[NSLayoutConstraint constant], /SourceCache/Foundation/Foundation /Layout.subproj/NSLayoutConstraint.m:6432015-10-26 08:43:06.080 AuberML[195:6172]
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '(null)'
原因:问题是IB将常数设置为“标准”,如果为标准的时候在iOS >= 9.0.1下,它的工作正常。iOS <9时则崩溃,它显然与Main.storyboard约束的定义中的以下symbolic =“YES”语句有关:
ndItem="c5b-4a-YMr" secondAttribute="bottom" multiplier="1175:1920" symbolic="YES" id="jgh-yf-mvT"/>```
![B8765392-7813-4FD1-ABDA-38CB4525E005.png](https://img.haomeiwen.com/i2443108/4d169a659737242d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
解决办法:将IB将常数设置为0
WebKit`WebKit::CompletionHandlerCallChecker::~CompletionHandlerCallChecker()
如下详细信息:
2017-06-14 22:15:30.331795+0800 Living[3104:1156485] invalid mode 'kCFRunLoopCommonModes' provided to CFRunLoopRunSpecific - break on _CFRunLoopError_RunCalledWithInvalidMode to debug. This message will only appear once per execution.
libc++abi.dylib: terminate_handler unexpectedly threw an exception
(lldb) bt
* thread #1: tid = 0x11a585, 0x0000000187ff1014 libsystem_kernel.dylib`__pthread_kill + 8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0000000187ff1014 libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x00000001880bb334 libsystem_pthread.dylib`pthread_kill + 112
frame #2: 0x0000000187f659c4 libsystem_c.dylib`abort + 140
frame #3: 0x0000000187a311b0 libc++abi.dylib`abort_message + 132
frame #4: 0x0000000187a475f0 libc++abi.dylib`std::__terminate(void (*)()) + 44
frame #5: 0x0000000187a46ef8 libc++abi.dylib`__cxa_throw + 136
frame #6: 0x0000000187a5866c libobjc.A.dylib`objc_exception_throw + 364
frame #7: 0x0000000188ff6f20 CoreFoundation`+[NSException raise:format:] + 116
frame #8: 0x0000000192685660 WebKit`WebKit::CompletionHandlerCallChecker::~CompletionHandlerCallChecker() + 144
frame #9: 0x00000001926c53d8 WebKit`WTF::ThreadSafeRefCounted<WebKit::CompletionHandlerCallChecker>::deref() const + 40
frame #10: 0x00000001926c4c14 WebKit`__destroy_helper_block_.138 + 68
frame #11: 0x0000000187f03a68 libsystem_blocks.dylib`_Block_release + 160
frame #12: 0x0000000187a76134 libobjc.A.dylib`(anonymous namespace)::AutoreleasePoolPage::pop(void*) + 836
frame #13: 0x0000000188ed2b18 CoreFoundation`_CFAutoreleasePoolPop + 28
frame #14: 0x00000001899f3dc8 Foundation`-[NSAutoreleasePool drain] + 148
frame #15: 0x000000018cecb2d4 JavaScriptCore`WTF::AutodrainedPool::~AutodrainedPool() + 32
frame #16: 0x000000018d86d098 JavaScriptCore`WTF::RunLoop::performWork(void*) + 44
frame #17: 0x0000000188fa5424 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
frame #18: 0x0000000188fa4d94 CoreFoundation`__CFRunLoopDoSources0 + 540
frame #19: 0x0000000188fa29a0 CoreFoundation`__CFRunLoopRun + 744
frame #20: 0x0000000188ed2d94 CoreFoundation`CFRunLoopRunSpecific + 424
frame #21: 0x000000018a93c074 GraphicsServices`GSEventRunModal + 100
frame #22: 0x000000018f18b130 UIKit`UIApplicationMain + 208
* frame #23: 0x000000010049489c CNLiving`main(argc=1, argv=0x000000016fd23958) + 124 at main.m:14
frame #24: 0x0000000187ee159c libdyld.dylib`start + 4
(lldb)
原因、解决办法,实现如下方法并调用decisionHandler(...):
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
// NSLog(@"%@--%@",hostname,navigationAction.request.URL);
// decisionHandler(WKNavigationActionPolicyCancel);
decisionHandler(WKNavigationActionPolicyAllow);
}
AFNetworking 请求设置说明:
_mannager = [AFHTTPRequestOperationManager manager];
//传入json格式数据,不写则普通post
_mannager.requestSerializer = [AFJSONRequestSerializer serializer];
//默认返回JSON类型(可以不写)
_mannager.responseSerializer = [AFHTTPResponseSerializer serializer];
//设置返回类型
_mannager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
library not found for -lPods
一般来说这个错就是库的连接引用有问题,常见解决办法:
方法一:在Build Phases 中的 Link Binary With Libraries 中对其xxx取消并且重新引用(灰色引用库都表示失效了,需要删除引用)。
如果还未解决,那可能是其它的原因,参考链接
Variable 'buttonTag' may be uninitialized when used here
Variable 'buttonTag' may be uninitialized when used here
是因为你的buttonTag
为枚举类型,初始化申明的时候未赋初始值,设置个初始值就可以了。
cocoapod安装错误:[!] Invalid Podfile
file: syntax error, unexpected end-of-input, expecting keyword_end.
podfile文件末尾未添加 end;
解决:在Podfile的末尾添加 end,如果你有多个target,需要在第一个target 的库引用完毕后添加end,如下图:
cocoapod常见错误这个挺全面的:http://www.jianshu.com/p/dfc7b93e67eb
合并framework库报错:can't move temporary file:
neghaodeiMac:~ neghao$ lipo -create /Users/neghao/Desktop/22/IJKMediaFramework.framework/IJKMediaFramework /Users/neghao/Desktop/IJKMediaFramework.framework/IJKMediaFramework -output /Users/neghao/Desktop/ijk
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't move temporary file: /Users/neghao/Desktop/ijk to file: /Users/neghao/Desktop/ijk.lipo (Is a directory)
是因为输出的文件没有取名,给输出的文件也取个名字就可以:
......前面不变 -output /Users/neghao/Desktop/ijk/IJKMediaFramework.framework
“The file ”MyApp.app“ couldn't be opened because you don't have permission to view it”
工程中有两个或者多个plist文件,把重复的删除,然后深度清理工程(command + option + shift + k),再运行。
Xocde9.1上打开xib文件崩溃:
Xcode crashes due to 'There can only be one document registered with a given URL.
Application Specific Information:
ProductBuildVersion: 8E3004b
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-12175.1/IDEKit/Application/IDEDocumentController.m:2136
Details: There can only be one document registered with a given URL. newDocument:<IDEWorkspaceDocument: 0x7ff6612d6cd0>( 0 -[IDEWorkspaceDocument init] (in IDEKit)
1 -[NSDocument initForURL:withContentsOfURL:ofType:error:] (in AppKit)
2 -[IDEWorkspaceDocument initForURL:withContentsOfURL:ofType:error:] (in IDEKit)
3 -[NSDocumentController makeDocumentForURL:withContentsOfURL:ofType:error:] (in AppKit)
4 __104-[NSDocumentController makeDocumentForURL:withContentsOfURL:alternateContents:ofType:completionHandler:]_block_invoke (in AppKit)
5 -[NSDocumentController makeDocumentForURL:withContentsOfURL:alternateContents:ofType:completionHandler:] (in AppKit)
6 __89-[NSDocumentController reopenDocumentForURL:withContentsOfURL:display:completionHandler:]_block_invoke (in AppKit)
解决办法:Remove this folder
/Users/<your user name>/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState
引用链接
Xcode运行项目时报:"You don’t have permission."
原因:你添加库或者其实文件时带有plist文件一起拖进去了,导致你工程有多个plist文件
解决办法:删除那个多余的文件。
真机运行时(基本都是发生在第一次)蹦出弹窗:
App installation failed
Could not inspect the application package.
几种处理方法:
1. product name为中文,就会出现这个问题。尝试各种clean,删资源,解决不了。把product name改成英文就好了。
2. 某个Resources文件名可能跟内部有冲突,重新修改资源名称;
3. 然后再清理:发生这个问题后,一定要用Clean Build Folder...,单纯的Clean无法解决问题。