2013-07-19 3 views
1
PO(self); 
    PO(_locationManager.delegate); 
    PO([CLLocationHandler singleton]); 
    _locationManager = [[CLLocationManager alloc] init]; 
    _locationManager.delegate = self; 
    PO(self); 
    PO(_locationManager.delegate); 
    NSAssert(_locationManager.delegate==self,@"They are meant for each other"); 

그래서이 코드는 시뮬레이터와 대부분의 iPhone에서 작동합니다. 저의 biz 파트너는 프로그램을 디버그 할 수없는 하나의 마법의 iPhone이 있습니다. 내가 설치된 프로그램을 실행하면이 간단한 코드가 어떻게 어설 션에 실패 할 수 있습니까?

직접 코드는이를 얻을 것입니다 : delegateProxy 도대체 무엇

<Warning>: *** -[NSKeyedUnarchiver initForReadingWithData:]: data is NULL 
<Warning>: self: <CLLocationHandler: 0x1f8df560> 
<Warning>: _locationManager.delegate: (null) <Warning>: [CLLocationHandler singleton]: <CLLocationHandler: 0x1f8df560> 
<Warning>: self: <CLLocationHandler: 0x1f8df560> 
<Warning>: _locationManager.delegate: <RwXSxTb_DelegateProxy: 0x1e594d00> 
<Warning>: *** Assertion failure in -[CLLocationHandler additionalInitialization], /business/Dropbox/badgers/BadgerNew/CLLocationHandler.m:251 
<Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'They are meant for each other' 

입니까?

+0

그의 iPhone과 관련된 구체적인 내용이 있습니까? 예를 들어 jailbroken입니까? –

+0

깨끗한 빌드를 권장합니다. – Sulthan

답변

3

디버깅중인 장치가 JB (감옥) 일 수 있습니다.

따라서 해당 장치에서 디버그 할 수 없습니다.

+0

사실 그건 사실입니다. 어떻게 알았어? –

+0

아니지만, 애플은 JB (Broken jail) 장치에서 디버깅이 허용되지 않습니다 :) –

2

속성에서 읽기가 정확히 동일한 값을 반환한다는 보장은 없습니다.

속성은 getter 및 setter 메서드를 호출하는 구문 설탕이며 이러한 메서드는 아무 것도 할 수 있습니다.

귀하의 경우에는 -[CLLocationHandler setDelegate:]이 프록시의 값을 래핑하는 것으로 보입니다. 대신 객체를 isEqual:으로 비교해보십시오. 많은 프록시가 올바르게 처리 할 것입니다.

관련 문제