2012-03-23 6 views
0

내 앱에서 길게 눌러 제스처가 있고 iOS 5.0에서 잘 작동하지만 ios 4.3에서는 예외가 있습니다. 여기에 내가 디버그에서 무엇을보고길게 누르는 제스처 문제

[UILongPressGestureRecognizer initWithCoder:]: unrecognized selector sent to instance 0x5863360 
2012-03-23 23:39:30.384 Woods2[289:ef03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILongPressGestureRecognizer initWithCoder:]: unrecognized selector sent to instance 0x5863360' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x013415a9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x01ce6313 objc_exception_throw + 44 
    2 CoreFoundation      0x013430bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 
    3 CoreFoundation      0x012b2966 ___forwarding___ + 966 
    4 CoreFoundation      0x012b2522 _CF_forwarding_prep_0 + 50 
    5 UIKit        0x005bb9fd UINibDecoderDecodeObjectForValue + 2592 
    6 UIKit        0x005bb2f5 UINibDecoderDecodeObjectForValue + 792 
    7 UIKit        0x005bc6ac -[UINibDecoder decodeObjectForKey:] + 398 
    8 UIKit        0x004d0c54 -[UINib instantiateWithOwner:options:] + 834 
    9 UIKit        0x004d2ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168 
    10 UIKit        0x00388628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70 
    11 UIKit        0x00386134 -[UIViewController loadView] + 120 
    12 UIKit        0x0038600e -[UIViewController view] + 56 
    13 Woods2        0x00004f37 -[FirstViewController viewDidLoad] + 1671 
    14 UIKit        0x00386089 -[UIViewController view] + 179 
    15 UIKit        0x00398f54 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 120 
    16 UIKit        0x00397aaa -[UITabBarController transitionFromViewController:toViewController:] + 64 
    17 UIKit        0x003998a2 -[UITabBarController _setSelectedViewController:] + 263 
    18 UIKit        0x00399d5e -[UITabBarController viewWillLayoutSubviews] + 170 
    19 UIKit        0x004aa2e9 -[UILayoutContainerView layoutSubviews] + 226 
    20 QuartzCore       0x019faa5a -[CALayer layoutSublayers] + 181 
    21 QuartzCore       0x019fcddc CALayerLayoutIfNeeded + 220 
    22 QuartzCore       0x019a20b4 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 310 
    23 QuartzCore       0x019a3294 _ZN2CA11Transaction6commitEv + 292 
    24 UIKit        0x002d89c9 -[UIApplication _reportAppLaunchFinished] + 39 
    25 UIKit        0x002d8e83 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 690 
    26 UIKit        0x002e3617 -[UIApplication handleEvent:withNewEvent:] + 1533 
    27 UIKit        0x002dbabf -[UIApplication sendEvent:] + 71 
    28 UIKit        0x002e0f2e _UIApplicationHandleEvent + 7576 
    29 GraphicsServices     0x015eb992 PurpleEventCallback + 1550 
    30 CoreFoundation      0x01322944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    31 CoreFoundation      0x01282cf7 __CFRunLoopDoSource1 + 215 
    32 CoreFoundation      0x0127ff83 __CFRunLoopRun + 979 
    33 CoreFoundation      0x0127f840 CFRunLoopRunSpecific + 208 
    34 CoreFoundation      0x0127f761 CFRunLoopRunInMode + 97 
    35 UIKit        0x002d87d2 -[UIApplication _run] + 623 
    36 UIKit        0x002e4c93 UIApplicationMain + 1160 
    37 Woods2        0x00001c2a main + 170 
    38 Woods2        0x00001b75 start + 53 
) 
terminate called throwing an exceptionkill 

도움이

여기

주셔서 대단히 감사하는 것은 그 추적 데이터가 훨씬 더 지금 포맷의 viewDidLoad

UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] 
             initWithTarget:self action:@selector(handleLongPress:)]; 
lpgr.minimumPressDuration = 0.2; //user needs to press for 2 seconds 
[mapView addGestureRecognizer:lpgr]; 
[lpgr release]; 
+0

handleLongPress :가 생성 된보기 컨트롤러에서 구현되었음을 확인할 수 있습니까? (initWithTarget : self와 동일한 클래스)? – danh

+0

예. 나는 mapView 있고이 mapView viewdidload있는이 코드가 있습니다. 내가 뭘해야되는거야? 감사합니다 –

답변

1

의 일부 코드이다. 이제는 사용자가 길게 누를 때조차도 loadFromNib에서 발생하는 것을 볼 수 있습니다. 펜촉이 다른 프로젝트에서 복사 된 경우 특히 유용합니다.

제스처 인식기를 펜촉으로 찾을 수 있는지 확인하십시오. 연결 관리자가 있으면 연결 관리자를 확인합니다. 다른 프로젝트의 심볼에 대한 잘못된 참조가있을 수 있습니다. (하나 이상의 연결 지점 근처에 작은 "!"이 보일 것입니다.)

찾으면 문제가 해결됩니다. 코드를 삭제하고 코드에서 설정 한 GR을 사용하십시오. (또는 펜촉의 포인터를 다시 구성하고 viewDidLoad의 코드를 주석 처리하십시오 :).

+0

지금 당장 sigabrt 있습니다 MapViewCntroller * map = [[MapViewCntroller alloc] init]; self.mapController = map; [self.view addSubview : self.mapController.view]; <---- 오류가 있습니다. [map release]; –

+0

감사합니다. 흠뻑 –

관련 문제