20年目睹之怪bug

release 情況下資源加載不出來的問題

上個版本上線后突然發(fā)現(xiàn)了一個問題,GIF加載動畫不出來了?!
切換到release環(huán)境下,100%的復現(xiàn)的bug
定位到問題在

YYImage *image = [YYImage imageNamed:@"qfloading.gif"];

path = [[NSBundle mainBundle] pathForResource:scaledName ofType:e];

這里path返回nil.

那解決辦法就找到了:
Build Phases -> Copy Bundle Resources 將gif加進去后,問題就解決了,release情況下gif可以正常顯示了

疑問:以前gif資源是放在Images.xcassets里的,而且線上也是沒有問題的,只有這個版本出現(xiàn)了問題,而且debug環(huán)境下沒有問題

上傳包到商店卡在authenticating with the app store

code11 在第一次上傳ipa的時候,需要更新上傳依賴的文件包. 依賴的上傳文件包沒有更新下來導致的上傳失敗.切換網(wǎng)絡環(huán)境(我用手機開的熱點好了),或者也可以

//1.刪掉 
~/Library/Caches/com.apple.amp.itmstransporter/
//2.重新執(zhí)行
/Applications/Transporter.app/Contents/itms/bin/iTMSTransporter

看這里

系統(tǒng)圖片出現(xiàn)灰色邊框的問題

iOS13發(fā)布后,UIImage有一個新增方法imageWithTintColor:,可以改變圖片的顏色

_imgView.image = [image imageWithTintColor:[UIColor redColor]];

有一些三方庫的類擴展比如 UIImage+Additions可能覆蓋了這個方法,導致出現(xiàn)這種系統(tǒng)icon出現(xiàn)灰色邊框的現(xiàn)象,刪掉這些方法就可以了


灰色邊框

UDID OpenUDID ASID 和UUID

UDID 設備唯一標識符,但是iOS 5以后禁用了
OpenUDID

// 廣告標識符IDFA
[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]
//應用加設備綁定產(chǎn)生的標識符
[[[UIDevice currentDevice] identifierForVendor] UUIDString]
//UUID
[[NSUUID UUID] UUIDString]

UITextFied 里輸入

123 456 789
然后選中456,刪除
會將123 和456中間的空格也刪掉。。
我只是要刪掉456?。?!誰叫你給我刪空格的!!

2. ios 14.0 UIMenuController 不出現(xiàn)

amazing ?
其他項目里都可以,寫得demo也可以。就是目前項目中未出來,原因未知,轉交其他同學處理~

線上是正常的,tf包不正常。離了個大譜?。?/p>

iOS 14.7.1reloadInputViews 會觸發(fā)keyboardWillHide的通知,造成input跳動~

- (void)viewDidLoad {
    [super viewDidLoad];
    _tf = [[UITextView alloc] initWithFrame:CGRectMake(10, 100, 200, 50)];
    _tf.backgroundColor = [UIColor redColor];
    [self.view addSubview:_tf];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardHidden:) name:UIKeyboardWillHideNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardShow:) name:UIKeyboardWillShowNotification object:nil];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    UIView *vie = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 100)];
    vie.backgroundColor = [UIColor redColor];
    self.tf.inputAccessoryView = self.tf.inputAccessoryView != nil ? nil : vie;
    [self.tf reloadInputViews];
}

- (void)keyboardHidden:(NSNotification *)noti {
    NSLog(@"keyboardHidden");
}
- (void)keyboardShow:(NSNotification *)noti {
    NSLog(@"keyboardShow");
}

14.7.1 log:

inputAccessoryView 為nil時
keyboardShow

nputAccessoryView 為存在View時:
keyboardHidden
keyboardShow

13.6 log:

inputAccessoryView 為nil時
keyboardShow

nputAccessoryView 為存在View時:
keyboardShow

可以看到,當nputAccessoryView 存在時,14.7會多執(zhí)行一次keyboardHidden通知

目前解決方案:
刷新鍵盤時,添加控制:

    self.reloadInputViewLock = YES;
    [self.inputBoxView.textContainerView.textView.internalTextView reloadInputViews];
    self.reloadInputViewLock = NO;

- (void)keyboardHidden:(NSNotification *)noti
{
    if (self.reloadInputViewLock) {
        return;
    }
。。。
}

當打包機的內(nèi)存不夠時候,會出現(xiàn)部分圖片資源打不進去的問題。

打出來的包在部分機型上會出問題

** Assertion failure in -[_UIImageCGImageContent initWithCGImage:scale:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3901.4.2/_UIImageContent.m:336
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Need an imageRef'

在組件打包為二進制后,部分宏定義會失效,比如斷言,或者當前開發(fā)環(huán)境等。 可能會遺漏一部分錯誤信息,但是優(yōu)點也非常明顯,加快了編譯速度.

當運行內(nèi)存不足時,會爆指針錯誤,目前項目中有非常多的類型情況,特別是YYText

Attempted to dereference garbage pointer 0xc.Originated at or in a subcall of bool

invalid update: invalid number of rows in section 0. the number of rows contained in an existing section after the update (20) must be equal to the number of rows contained in that section before the update (20), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).'

tableView 和 collectionView的cell操作引起的問題,原因往往是數(shù)據(jù)源和cell不一致導致。
deleteRowsAtIndexPaths
insertSections
類似操作一定要加好判斷,不然很容易引起類似問題

最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容