3
NSThread에서 하나의 메서드를 호출하려면 어떻게해야합니까?NSThread에서 하나 이상의 매개 변수가있는 메서드를 하나만 호출하십시오.
내가 하나의 방법 아래와 같이 호출 할 수 있습니다 :
[regionsMapView addAnnotation:addAnnotation];
은 어떻게 NSThread에 있음을 호출 할 수 있습니다? 나는 아래와 같이 사용하고 있습니다 : 아래와 같은 로그와
[NSThread detachNewThreadSelector:@selector(addAnnotation)
toTarget:regionsMapView
withObject:addAnnotation];
그러나 응용 프로그램 충돌 :
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSThread initWithTarget:selector:object:]: target does not implement selector (*** -[MKMapView addAnnotation])'
*** Call stack at first throw:
(
0 CoreFoundation 0x0182b5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0197f313 objc_exception_throw + 44
2 CoreFoundation 0x017e3ef8 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x017e3e6a +[NSException raise:format:] + 58
4 Foundation 0x0006c392 -[NSThread initWithTarget:selector:object:] + 146
5 Foundation 0x0006c2d3 +[NSThread detachNewThreadSelector:toTarget:withObject:] + 98
6 MJA 0x00008a8e -[TaetPaViewController showAddress:withItem:] + 389
7 MJA 0x00008eb9 -[TaetPaViewController UpdateInfo] + 784
8 MJA 0x0000835a -[TaetPaViewController parseTheLocalXml] + 408
9 Foundation 0x0006ccf4 -[NSThread main] + 81
10 Foundation 0x0006cc80 __NSThread__main__ + 1387
11 libSystem.B.dylib 0x911a47fd _pthread_start + 345
12 libSystem.B.dylib 0x911a4682 thread_start + 34
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
감사합니다. 메서드에 둘 이상의 매개 변수가 있으면 어떻게됩니까? – itsazzad
앱이 중단됩니다. 하나의 매개 변수를 사용하고 반환 값이없는 메서드 만 사용할 수 있습니다. – Pierre
우수. 나를 위해 일했다. – justinkoh