ld: warning: embedded dylibs/frameworks only run/supported on iOS 8 or later
原因: framework支持的最低开发环境为8.0,工程却低于8.0
方案: 选低版本开发环境重新编译framework(BuildSettings->iOS Deployment Target->7.0)或者改工程高于8.0
Application Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure
原因: 默认禁止http
方案: Info.plist 添加NSAppTransportSecurity(Dict)--> NSAllowsArbitraryLoads(Bool)
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>域名.com</key>
<dict>
<!--允许子域名:subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--允许App进行不安全的HTTP请求-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--在这里声明所支持的 TLS 最低版本-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
subsystem: com.apple.UIKit, category:
原因: Xcode8打印过多信息
方案: Product–>Scheme–>Edict Scheme–>Run–>Envlronment Variables –>添加OS_ACTIVITY_MODE值disable
iOS-Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be complet
原因: json数据当中有 \\n \\r \\t 等制表符
方案:
NSString * responseString = [request responseString];
responseString = [responseString stringByReplacingOccurrencesOfString:@"\\\\r\\\\n" withString:@""];
responseString = [responseString stringByReplacingOccurrencesOfString:@"\\\\n" withString:@""];
responseString = [responseString stringByReplacingOccurrencesOfString:@"\\\\t" withString:@""];
// 然后在使用系统自带方法进行JSON字符串解析
[NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableLeaves error:&error];
Masonry崩溃NSAssert(NO, @"attempting to add unsupported attribute: %@", secondViewAttribute)
原因: 布局顺序有问题
方案: 改变参照
CocoaPods 出现Unable to convert Ruby value `"AFNetworking"' into a CFTypeRef
原因: 这是ruby本身bug,升级版本即可
方案: CocoaPods附加
Could not find file: /Users/RainDou/Library/Developer/Xcode/DerivedData/.../Animate.png
原因: 图片后缀png,但只是其他格式改变图片后缀,元数据不是
方案: 将图片真的转化为png格式,而不是改后缀
Assigning to 'id<Delegate>' from incompatible type 'ViewController *const_strong
原因: 设置了delegate = self,但是self没有遵守这个协议
方案: 遵循协议<xxxDelegate>
控制台打印 NSGenericException
原因: 数组操作不当,如for in循环中改变数组自身数据
方案: 禁止在循环中操作数组本身
property follows cocoa naming convention for returning 'owned' objects
原因:命名不规范,属性不能以关键字开头,如alloc,new,copy,mutableCopy
方案:更改命名
SVN Description : The working copy is locked due to a previous error
原因:文件传输未完成时关闭连接容易出现
方案:右击左侧工程目录,点击clean
Invalid pointer dequeued from free list set a breakpoint in malloc_error_break to debug
原因:工程中应用了非RGB图片,导致内存问题
方案:将问题图片替换为sRGB图片
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [nan 0; nan 10]'
原因:代码有除以0部分,比如用sizeWithFont方法计算UILabel宽高,NSString为nil的时候,sizeWithFont会除以0了。
方案:做判断
执行reloadData 后UICollectionView的cel.hidden = YES导致cell消失
原因:子线程reload
方案:dispatch_async(dispatch_get_main_queue(), ^{ [self.collectionView reloadData]; });
Assertion failure in -[UICollectionViewData validateLayoutInRect:]
原因:VC中使用两个UICollectionView, reloadData时若数据源个数多于更新之前可能出现Assertion failure
方案:千万不要使用同一个flowLayout
-[__NSArray0 objectForKeyedSubscript:]: unrecognized selector sent to instance 0x7fd4225022c0
原因:数据类型不匹配,把数组当字典用了
方案:添加判断条件
使用WKWebView “OBJC_CLASS$_WKWebView”, referenced from:
原因:没有引入WebKit.framework
方案:在target--build Phases -- Link Banary...添加WebKit.framework
scrollRectToVisible不起作用
原因:可能是contentSize 中width或者height为0
方案:设置非0值
宏定义不识别
原因:xcode没能正确编译
方案:关闭xcode,终端 open /Users/yourname/Library/Developer/Xcode/DerivedData 或者前往该文件夹,删除其子目录
class AVPlayerItem was deallocated while key value observers were still registered with it.
原因:播放失败时可能 self.player.currentItem==nil
方案:
if (self.player && self.player.currentItem)
{
[self.player.currentItem removeObserver:self forKeyPath:@"status"];
}
使用UIImagePickerConroller 设置picker.mediaTypes = @[(NSString *)kUTTypeMovie];
kUTTypeMovie 不识别
原因:没有引入头文件
方案:#import <MobileCoreServices/MobileCoreServices.h>
移除监听者崩溃问题
原因:监听者不存在或者被监听者对象不存在
方案:
if (self.player && self.player.currentItem)
{
@try
{
[self.player.currentItem removeObserver:self forKeyPath:@"status"];
}
@catch (NSException *exception)
{
DDYInfoLog(@"已经移除了监听者");
}
}
push隐藏tabbar,pop回来后tabbar不见了
ViewController *vc = [[ViewController alloc] init];
[self setHidesBottomBarWhenPushed:YES];
[self.navigationController pushViewController:vc animated:YES];
原因:当前控制器调用了隐藏tabbar
方案:[self setHidesBottomBarWhenPushed:YES];改为[vc setHidesBottomBarWhenPushed:YES];
长按手势明明长按一次却执行两次
原因:没有处理手势到底何种状态
方案:
if (longPressGesture.state == UIGestureRecognizerStateBegan) {
// do something
}else if (longPressGesture.state == UIGestureRecognizerStateEnded){
// do something
}
reason: 'child view controller:<UICompatibilityInputViewController: 0x1103f9d40>
should have parent view controller:<StopChooser: 0x11083e200> but requested parent is:<UIInputWindowController: 0x110858800>'
原因:添加的inputView不能以 'inputView' 命名,也不能属于任何其他父视图
方案:
mTextField.inputView = mInputVeiw;
[mInputVeiw removeFromSuperview];
[mTextField becomeFirstResponder];
NSTimer 不执行
原因:线程阻塞
方案:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSTimer* t = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(Reconnect:) userInfo:nil repeats:NO];
[[NSRunLoop currentRunLoop] addTimer:t forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] run];
});
svn 强退后 Previous operation has not finished; run 'cleanup' if it was interrupted.
原因:可能是频繁做了一些改名,文件打开的时候更新或者提交操作,导致svn罢工了
方案:进入工程目录(显示隐藏文件),找到.svn并进入 执行 sqlite3 wc.db "delete from work_queue"。然后执行clean
Your application has presented a UIAlertController (<UIAlertController: 0x7af36380>) of style
UIAlertControllerStyleActionSheet. The modalPresentationStyle of a UIAlertController with this
style is UIModalPresentationPopover. You must provide location information for this popover through the alert
controller's popoverPresentationController. You must provide either a sourceView and sourceRect or a
barButtonItem. If this information is not known when you present the alert controller, you may provide it in
the UIPopoverPresentationControllerDelegate method -prepareForPopoverPresentation.
UIPopoverPresentationController *popover = alertController.popoverPresentationController;
// 需要啥就给他啥
if (popover) {
popover.sourceView = imageView;
popover.sourceRect = imageView.bounds;
popover.permittedArrowDirections = UIPopoverArrowDirectionAny;
popover.delegate= self;
}
UniversalLink