2025-04-23

1.[AppModel copyWithZone:]: unrecognized selector sent to instance 0x7ffda9f4cf70

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppModel copyWithZone:]: unrecognized selector sent to instance 0x7ffda9f4cf70'

*** First throw call stack:

這種錯誤的原因:屬性定義的問題應該註意在定義屬性時即在定義

property時幾個出現問題的可能能

nonatomic:單線程,效率較高

atomic:多線程,效率優點低,但是是默認的

readWrite:可讀可寫,它也是默認的

readOnly:隻可讀

assign:指的是int,float.等數值類型,他是默認的

copy:指的是字符串對象。例如名字

retain:指的是對象。例如時間對象

strong:強引用

weak:弱引用

我出錯的原因就是在定義類對象時,誤用瞭copy代替strong

2. 在使用tableView時會發現有時這個方法不執行,原因:_tableView的frame未設置,還有就是_dataArry未賦值是空的。還有一種就是在取的數據時采用的是異步的方式,但是木有刷新tableView數據

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

return nil;

}

3.數據NSData未初始化帶來的錯誤

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'

4.如果取出的數據有為空時就會出現如下錯誤

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 3 beyond bounds [0 .. 2]'

 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *