
iOS 错误处理
文章平均质量分 85
Jymn_Chen
这个作者很懒,什么都没留下…
展开
-
TableViewCell常见的小问题
用TableViewCell经常遇到小问题搞到整个程序崩溃。最常见的错误:unable to dequeue a cell with identifier cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard,如下图所示:原因是原创 2013-08-03 17:14:29 · 11370 阅读 · 0 评论 -
Undefined symbols for architecture i386: "_OBJC_CLASS_$_XX" 错误解决方法
出现Undefined symbols for architecture i386: "_OBJC_CLASS_$_XX"的错误,原因通常在于无法识别的标记所在的类文件没有被加入到Compile Sources中。原创 2014-03-20 14:10:44 · 5083 阅读 · 0 评论 -
Xcode 无法检测到真机设备问题解决
为什么我的设备明明连上了,但是Xcode却检测不到?尝试修改iOS Deployment Target吧。原创 2014-04-19 00:22:41 · 8869 阅读 · 0 评论 -
使用CocoaPods出现 The `master` repo requires CocoaPods 0.32.1 - 问题解决
最近在使用CocoaPods为工程配置第三方类库时出现了如下问题:[!] The `master` repo requires CocoaPods 0.32.1 -明显是因为CocoaPods没有升级到最新版本。解决方法:$ sudo gem update cocoapods原创 2014-04-25 23:08:15 · 4899 阅读 · 0 评论 -
消除warning:PerformSelector may cause a leak because its selector is unknown
This is a warning generated by the compiler because -Wundeclared-selector was used while compiling and automatic reference counting (ARC) is enabled. This can be, in general, safely ignored, as it's转载 2014-07-24 21:25:44 · 8005 阅读 · 0 评论 -
.m文件导入C++头文件带来的错误
.m文件导入C++头文件带来编译错误,解决方法:将引用C++头文件的.m文件后缀修改为.mm。原创 2014-07-30 22:20:13 · 2780 阅读 · 0 评论 -
MBProgressHUD -[__NSCFString sizeWithAttributes:]: unrecognized selector问题解决
最近的工作需要将工程打包成静态库文件,然后提供给别人使用。在工程中有引用MBProgressHUD,在打包出静态库文件后,写了个Demo,引用了其中的一段代码来显示MBProgressHUD,在iOS 6的设备上跑时却崩溃了,错误提示为:“-[__NSCFString sizeWithAttributes:]: unrecognized selector sent to XXXXXX”原创 2014-07-30 22:57:11 · 3970 阅读 · 1 评论 -
iOS duplicate symbol _main in:问题解决
今天手贱给自己挖了个坑,由于工程中一些文件是后台的小伙伴写的C/C++文件,所以我一次性全部导入了,但是编译时出现了duplicate symbol _main in: A.o和B.o的编译错误。原创 2014-07-30 23:42:21 · 10431 阅读 · 0 评论 -
iOS 在Xcode中使用C++ Library
如何在 Xcode 4.5.1 編譯 c++ 程式,並使用它。首先在 Xcode 中打開一個 project ,然後點擊左上角檔案管理中的第一個藍色資料夾。再來要選擇Build Settings,接著把捲軸往下拉,就會看到 Apple LLVM Compile 的區塊,點擊選項compile source as, 並選擇「 Objective-C++」。選好转载 2014-07-30 22:28:04 · 6773 阅读 · 0 评论 -
-all_load -force_load -ObjC
-ObjC: This flag causes the linker to load every object file in the library that defines an Objective-C class or category.While this option will typically result in a larger executable (due to a转载 2014-07-31 16:37:22 · 1772 阅读 · 0 评论 -
addChildViewController时viewDidAppear方法得不到调用的问题
今天遇到一个无比诡异的问题,原因在于viewDidLoad方法得到调用,而viewDidAppear方法得不到调用,导致viewDidAppear方法中的代码得不到执行。本文写了个Demo,完整地模拟了这个场景。原创 2014-09-25 01:51:00 · 5969 阅读 · 0 评论 -
xcode-select: error: tool 'xcodebuild' requires Xcode错误解决方法
因为机子里有两个Xcode,所以分别重命名了,但是在运行一个MakeFile时却报了以下错误:xcodebuild -target "GHUnitIOS (Device)" -configuration Release SYMROOT=buildxcode-select: error: tool 'xcodebuild' requires Xcode, but active develope原创 2014-03-20 13:46:56 · 27061 阅读 · 0 评论 -
iOS 小心删除Documents中的文件
删除Sandbox中Documents目录下的文件可能是个比较常用的操作,但是如果文件名没有正确设置,就会有删除整个Documents的危险出现,因此在删除前要做好判断。原创 2014-03-15 13:08:22 · 5109 阅读 · 0 评论 -
Xcode5 After modifying system headers, please delete the module cache
在使用Xcode 5遇到After modifying system headers, please delete the module cache问题时的解决办法。原创 2013-10-02 20:24:05 · 5273 阅读 · 1 评论 -
nested push animation can result in corrupted navigation bar问题解决
当接受到推送通知时,需要要求跳转到指定的页面。我们登录成功后只有一个viewcontroller,并且为导航视图。所以可以,使用 popToRootViewControllerAnimated 先跳转到根视图,然后在从根视图push到其他视图。这个理论上是没有问题。但是在实际操作中,页面在跳转到你理想的界面以后,你再使用 [self.navigationController pop转载 2013-11-25 23:55:07 · 3024 阅读 · 0 评论 -
The operation couldn’t be completed. (OSStatus error -43.)
网上查资料时说该错误的原因多种多样。本人目前遇到过一种,就是播放声音文件时文件的路径出错(文件不存在,当然播放不了啦),这个只要修正文件的路径就没问题了。另一种个人觉得比较有可能遇到的就是AVAudioPlayer没有及时release掉,所以应该在Play完成后做好事后处理工作:#pragma mark - Audio player delegate- (void)aud原创 2013-11-25 19:49:54 · 5187 阅读 · 0 评论 -
Warning: Attempt to present A on B whose view is not in the window hierarchy!
使用故事板和segue时可能会遇到这个问题:Warning: Attempt to present A on B whose view is not in the window hierarchy! 本文说一下其解决方法以及分析一下造成问题的原因。原创 2013-10-02 19:36:09 · 12091 阅读 · 2 评论 -
出现NSGenericException异常的解决方案
一个很简单的原则,不能够再for in循环中修改所遍历的数组,无论你是add或remove都不可以,如果你要修改的话,建议实用for(;;;)格式的。。。for (id elem in arr) { [arr removeObject:elem];}这个是错误的,你应该改成:for (NSINteger i = 0 i , [arr count转载 2013-11-19 11:14:16 · 2688 阅读 · 0 评论 -
Error The operation couldn’t be completed. (Cocoa error 516.)
This is very common error that happens when you try to create a file on the file system and a file with the same name already exists. You can avoid that by checking whether a file with the name alread转载 2013-11-21 19:29:25 · 5675 阅读 · 0 评论 -
CAF转换MP3的lame库编译问题解决
最近在使用lame库将CAF转换为MP3时遇到一个编译错误,此时的模拟器处于64bit位环境下。本文给出解决方法,并估计原因所在。原创 2013-11-28 15:20:18 · 6097 阅读 · 2 评论 -
使用NSKeyedUnarchiver解压数据如何防止crash
使用NSKeyedUnarchiver解压二进制数据,如果解压时数据为nil,或者数据中有异常的数据,那么解压将会出错,甚至会导致程序crash掉。本文说说这种情况下如何防止程序崩溃。原创 2013-11-29 18:40:52 · 6547 阅读 · 0 评论 -
使用MFMailComposeViewController发送邮件时防止崩溃
使用MFMailComposeViewController发送邮件时防止崩溃。原创 2014-02-15 22:00:10 · 7431 阅读 · 1 评论 -
移动bundle中的文件时出现错误:Cocoa error 513
在iOS中,加载app成功后bundle中的文件将被加载到.app包中,注意不要将该包中的文件移动到外部。#pragma mark - Move file- (void)moveFileFromPath:(NSString *)srcFilePath toPath:(NSString *)desFilePath { NSFileManager *fileManager = [NSF原创 2014-03-01 15:14:57 · 4205 阅读 · 0 评论