ios app NSException

前手放留隻 app 走咗, 依家要執手尾, 可以 build 到, 但一 run 就死, 係實機 iphone8 測試,

#import <UIKit/UIKit.h>

int main(int argc, char *argv[]) {
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  int retVal = UIApplicationMain(argc, argv, nil, nil);
  [pool release];
  return retVal;
}

停咗係上面 bold 咗果句...

error msg:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 7 beyond bounds for empty NSArray'
*** First throw call stack:
(0x181e3ad8c 0x180ff45ec 0x181d96448 0x10029aa24 0x18ba49dbc 0x18ba491c4 0x18ba165e0 0x18c046b1c 0x18ba15dd0 0x18ba15c6c 0x18ba14afc 0x18c6aa84c 0x18ba141ec 0x18c48fac8 0x18c5ddbf8 0x18ba13c0c 0x18ba135a8 0x18ba105e0 0x18ba10330 0x18463c470 0x184644d6c 0x10077d19c 0x1007897cc 0x184670878 0x18467051c 0x184670ab8 0x181de3404 0x181de2c2c 0x181de079c 0x181d00da8 0x183ce6020 0x18bd20758 0x10029a0c8 0x181791fc0)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

有冇 xcode 高手師兄幫幫手, 萬分感謝!!!

你假如寫過任何language, 一睇就知咩叫index out of bounds.
你都係搵人接手啦。

TOP

死因好清楚
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 7 beyond bounds for empty NSArray'

如果你唔明既話都係交比人啦

TOP

唉... 就係冇人識寫 ios, 依啲有冇 freelance 肯做? 通常收幾錢?

TOP

NSArray index out of bounds 都係九成九個 data layer 出事 ga je
問題係 obj-c 都算,淨係見到個 main.m 就知啲 code 舊到一個點
要 support 返新 device, run 到都大把屎要執,仲要轉 Safe Area Layout etc
咁嘅豬頭骨除非好等錢洗,如果唔係擺明大伏

TOP

起碼3-4年前寫落
上唔上到架都成問題

TOP

本帖最後由 七彩小生 於 2018-8-13 22:24 編輯

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

你哋咁樣都可以明白咁複雜coding syntax , 你哋真係好強 . 我見到都掉頭走

TOP

很久未見過MRC project了

TOP

多謝各位, 搵人幫手解決了, 要遂行 break point 先知咩事...

TOP