ld: warning: embedded dylibs/frameworks only run/supported on iOS 8 or later
原因: framework支持的最低開(kāi)發(fā)環(huán)境為8.0,工程卻低于8.0
方案: 選低版本開(kāi)發(fā)環(huán)境重新編譯framework(BuildSettings->iOS Deployment Target->7.0)或者改工程高于8.0
Application Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure
原因: 默認(rèn)禁止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進(jìn)行不安全的HTTP請(qǐng)求-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--在這里聲明所支持的 TLS 最低版本-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
subsystem: com.apple.UIKit, category:
原因: Xcode8打印過(guò)多信息
方案: Product–>Scheme–>Edict Scheme–>Run–>Envlronment Variables –>添加OS_ACTIVITY_MODE值disable
iOS-Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be complet
原因: json數(shù)據(jù)當(dāng)中有 \\n \\r \\t 等制表符
方案:
NSString * responseString = [request responseString];
responseString = [responseString stringByReplacingOccurrencesOfString:@"\\\\r\\\\n" withString:@""];
responseString = [responseString stringByReplacingOccurrencesOfString:@"\\\\n" withString:@""];
responseString = [responseString stringByReplacingOccurrencesOfString:@"\\\\t" withString:@""];
// 然后在使用系統(tǒng)自帶方法進(jìn)行JSON字符串解析
[NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableLeaves error:&error];
Masonry崩潰NSAssert(NO, @"attempting to add unsupported attribute: %@", secondViewAttribute)
原因: 布局順序有問(wèn)題
方案: 改變參照
CocoaPods 出現(xiàn)Unable to convert Ruby value `"AFNetworking"' into a CFTypeRef
原因: 這是ruby本身bug法瑟,升級(jí)版本即可
方案: CocoaPods附加
Could not find file: /Users/RainDou/Library/Developer/Xcode/DerivedData/.../Animate.png
原因: 圖片后綴png,但只是其他格式改變圖片后綴播玖,元數(shù)據(jù)不是
方案: 將圖片真的轉(zhuǎn)化為png格式,而不是改后綴
Assigning to 'id<Delegate>' from incompatible type 'ViewController *const_strong
原因: 設(shè)置了delegate = self,但是self沒(méi)有遵守這個(gè)協(xié)議
方案: 遵循協(xié)議<xxxDelegate>
控制臺(tái)打印 NSGenericException
原因: 數(shù)組操作不當(dāng),如for in循環(huán)中改變數(shù)組自身數(shù)據(jù)
方案: 禁止在循環(huán)中操作數(shù)組本身
property follows cocoa naming convention for returning 'owned' objects
原因:命名不規(guī)范,屬性不能以關(guān)鍵字開(kāi)頭,如alloc,new邻吞,copy壶谒,mutableCopy
方案:更改命名
SVN Description : The working copy is locked due to a previous error
原因:文件傳輸未完成時(shí)關(guān)閉連接容易出現(xiàn)
方案:右擊左側(cè)工程目錄,點(diǎn)擊clean
Invalid pointer dequeued from free list set a breakpoint in malloc_error_break to debug
原因:工程中應(yīng)用了非RGB圖片抒和,導(dǎo)致內(nèi)存問(wèn)題
方案:將問(wèn)題圖片替換為sRGB圖片
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [nan 0; nan 10]'
原因:代碼有除以0部分矫渔,比如用sizeWithFont方法計(jì)算UILabel寬高,NSString為nil的時(shí)候摧莽,sizeWithFont會(huì)除以0了庙洼。
方案:做判斷
執(zhí)行reloadData 后UICollectionView的cel.hidden = YES導(dǎo)致cell消失
原因:子線(xiàn)程reload
方案:dispatch_async(dispatch_get_main_queue(), ^{ [self.collectionView reloadData]; });
Assertion failure in -[UICollectionViewData validateLayoutInRect:]
原因:VC中使用兩個(gè)UICollectionView, reloadData時(shí)若數(shù)據(jù)源個(gè)數(shù)多于更新之前可能出現(xiàn)Assertion failure
方案:千萬(wàn)不要使用同一個(gè)flowLayout
-[__NSArray0 objectForKeyedSubscript:]: unrecognized selector sent to instance 0x7fd4225022c0
原因:數(shù)據(jù)類(lèi)型不匹配,把數(shù)組當(dāng)字典用了
方案:添加判斷條件
使用WKWebView “OBJC_CLASS$_WKWebView”, referenced from:
原因:沒(méi)有引入WebKit.framework
方案:在target--build Phases -- Link Banary...添加WebKit.framework
scrollRectToVisible不起作用
原因:可能是contentSize 中width或者h(yuǎn)eight為0
方案:設(shè)置非0值
宏定義不識(shí)別
原因:xcode沒(méi)能正確編譯
方案:關(guān)閉xcode,終端 open /Users/yourname/Library/Developer/Xcode/DerivedData 或者前往該文件夾,刪除其子目錄
class AVPlayerItem was deallocated while key value observers were still registered with it.
原因:播放失敗時(shí)可能 self.player.currentItem==nil
方案:
if (self.player && self.player.currentItem)
{
[self.player.currentItem removeObserver:self forKeyPath:@"status"];
}
使用UIImagePickerConroller 設(shè)置picker.mediaTypes = @[(NSString *)kUTTypeMovie];
kUTTypeMovie 不識(shí)別
原因:沒(méi)有引入頭文件
方案:#import <MobileCoreServices/MobileCoreServices.h>
移除監(jiān)聽(tīng)者崩潰問(wèn)題
原因:監(jiān)聽(tīng)者不存在或者被監(jiān)聽(tīng)者對(duì)象不存在
方案:
if (self.player && self.player.currentItem)
{
@try
{
[self.player.currentItem removeObserver:self forKeyPath:@"status"];
}
@catch (NSException *exception)
{
DDYInfoLog(@"已經(jīng)移除了監(jiān)聽(tīng)者");
}
}
push隱藏tabbar范嘱,pop回來(lái)后tabbar不見(jiàn)了
ViewController *vc = [[ViewController alloc] init];
[self setHidesBottomBarWhenPushed:YES];
[self.navigationController pushViewController:vc animated:YES];
原因:當(dāng)前控制器調(diào)用了隱藏tabbar
方案:[self setHidesBottomBarWhenPushed:YES];改為[vc setHidesBottomBarWhenPushed:YES];
長(zhǎng)按手勢(shì)明明長(zhǎng)按一次卻執(zhí)行兩次
原因:沒(méi)有處理手勢(shì)到底何種狀態(tài)
方案:
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 不執(zhí)行
原因:線(xiàn)程阻塞
方案:
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 強(qiáng)退后 Previous operation has not finished; run 'cleanup' if it was interrupted.
原因:可能是頻繁做了一些改名,文件打開(kāi)的時(shí)候更新或者提交操作丑蛤,導(dǎo)致svn罷工了
方案:進(jìn)入工程目錄(顯示隱藏文件)叠聋,找到.svn并進(jìn)入 執(zhí)行 sqlite3 wc.db "delete from work_queue"。然后執(zhí)行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