2011-04-18 26 views
1

我想知道爲什麼我得到一個錯誤信息爲什麼在嘗試NSScanner在NSString語句中使用時收到錯誤消息?

Thread 1: Program received signal: "SIGABRT") 

當我使用這行代碼:

NSScanner *userEntered = [[NSScanner alloc] scannerWithString:temp]; 

的錯誤是:

2011-04-18 02:06:11.995 XXX[25929:207] -[NSConcreteScanner scannerWithString:]: unrecognized selector sent to instance 0x6816bc0 
2011-04-18 02:06:11.999 XXX[25929:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteScanner scannerWithString:]: unrecognized selector sent to instance 0x6816bc0' 

謝謝。

回答

3

+ scannerWithString是一個類方法和應使用的方式如下:

NSScanner *userEntered = [NSScanner scannerWithString:temp]; 
相關問題