2012-05-17 2 views
0

내 응용 프로그램에서 아래의 문제를 gettting하고있는 잘 작동 :충돌은, (Pls는 나를 도와) 시뮬레이터

*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [1.07157e-08 nan]' 
    *** Call stack at first throw: 
    (
     0 CoreFoundation      0x3126a64f __exceptionPreprocess + 114 
     1 libobjc.A.dylib      0x32b12c5d objc_exception_throw + 24 
     2 CoreFoundation      0x3126a491 +[NSException raise:format:arguments:] + 68 
     3 CoreFoundation      0x3126a4cb +[NSException raise:format:] + 34 
     4 QuartzCore       0x32c6f61d _ZL18CALayerSetPositionP7CALayerRKN2CA4Vec2IdEEb + 140 
     5 QuartzCore       0x32c6f58b -[CALayer setPosition:] + 38 
     6 QuartzCore       0x32c6f4d7 -[CALayer setFrame:] + 390 
     7 UIKit        0x35a31455 -[UIView(Geometry) setFrame:] + 188 
     8 UIKit        0x35a51743 UIViewCommonInitWithFrame + 594 
     9 UIKit        0x35a514a1 -[UIView initWithFrame:] + 84 
     10 CaCaCard       0x0000683b -[CaCaCardsAppViewController shouldAutorotateToInterfaceOrientation:] + 510 
     11 UIKit        0x35a6eead -[UIViewController _isSupportedInterfaceOrientation:] + 48 
     12 UIKit        0x35a6ee6f -[UINavigationController _doesTopViewControllerSupportInterfaceOrientation:] + 46 
     13 UIKit        0x35a6ee37 -[UINavigationController shouldAutorotateToInterfaceOrientation:] + 14 
     14 UIKit        0x35a6edbf -[UINavigationController _isSupportedInterfaceOrientation:] + 54 
     15 UIKit        0x35a6fbbb -[UIViewController window:shouldAutorotateToInterfaceOrientation:] + 46 
     16 UIKit        0x35a6f857 -[UIWindow _shouldAutorotateToInterfaceOrientation:] + 194 
     17 UIKit        0x35a6f4a3 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 366 
     18 UIKit        0x35a6f0ad -[UIWindow setDelegate:] + 168 
     19 UIKit        0x35a6efa9 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 64 
     20 UIKit        0x35a6d611 -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:] + 460 
     21 UIKit        0x35a6d3e5 -[UINavigationController viewDidMoveToWindow:shouldAppearOrDisappear:] + 36 
     22 UIKit        0x35a4c5a7 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 506 
     23 UIKit        0x35a4c32f -[UIView(Hierarchy) _postMovedFromSuperview:] + 106 
     24 UIKit        0x35a31c1b -[UIView(Internal) _addSubview:positioned:relativeTo:] + 678 
     25 UIKit        0x35a3196b -[UIView(Hierarchy) addSubview:] + 22 
     26 CaCaCard       0x00004bcf -[CaCaCardsAppAppDelegate application:didFinishLaunchingWithOptions:] + 318 
     27 UIKit        0x35a61821 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 772 
     28 UIKit        0x35a5bb65 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 272 
     29 UIKit        0x35a307d7 -[UIApplication handleEvent:withNewEvent:] + 1114 
     30 UIKit        0x35a30215 -[UIApplication sendEvent:] + 44 
     31 UIKit        0x35a2fc53 _UIApplicationHandleEvent + 5090 
     32 GraphicsServices     0x31d37e77 PurpleEventCallback + 666 
     33 CoreFoundation      0x31241a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26 
     34 CoreFoundation      0x3124383f __CFRunLoopDoSource1 + 166 
     35 CoreFoundation      0x3124460d __CFRunLoopRun + 520 
     36 CoreFoundation      0x311d4ec3 CFRunLoopRunSpecific + 230 
     37 CoreFoundation      0x311d4dcb CFRunLoopRunInMode + 58 
     38 UIKit        0x35a5ad49 -[UIApplication _run] + 372 
     39 UIKit        0x35a58807 UIApplicationMain + 670 
     40 CaCaCard       0x000028e7 main + 70 
     41 CaCaCard       0x0000289c start + 40 
    ) 
    terminate called after throwing an instance of 'NSException' 
    Program received signal: “SIGABRT”. 
    warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.5 (8L1)/Symbols/Developer/usr/lib/libXcod 

eDebuggerSupport.dylib (file not found). 
(gdb) 

-(void) viewWillAppear:(BOOL)animated 
//----------------------------------- 
{ 
    if (self.interfaceOrientation == UIInterfaceOrientationPortrait || 
     self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ) 
    { 
     [NSThread sleepForTimeInterval:0.5]; 

     [UIView beginAnimations:@"View Flip" context:nil]; 
     [UIView setAnimationDuration:1.25]; 
     [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 

     [[UIApplication sharedApplication] setStatusBarOrientation: 
     UIInterfaceOrientationLandscapeRight]; 

     UIScreen *screen = [UIScreen mainScreen]; 
     CGFloat screenWidth = screen.bounds.size.width; 
     CGFloat screenHeight = screen.bounds.size.height; 
     UIView *navView = [[self navigationController] view]; 
     navView.bounds = CGRectMake(0, 0, screenHeight, screenWidth); 
     navView.transform = CGAffineTransformIdentity; 
     navView.transform = CGAffineTransformMakeRotation(degreesToRadian(90)); 
     navView.center = CGPointMake(screenWidth/2.0, screenHeight/2.0); 

     [UIView commitAnimations]; 

    } 

    fontSelected = NO; 

} 
+0

코드가 회전 중에 애니메이션을 수행하는지 여부는? – rishi

+0

@rishi : 애니메이션 코드 – user198725878

+0

이있는 업데이트 된 코드를 참조하십시오. CaCaCardsAppViewController의 shouldAutorotateToInterfaceOrientation : 메소드 (잘못된 프레임 크기 일 수 있음)에서 새보기를 초기화하는 것과 관련이 있다고합니다. 이 코드는 어떻게 생겼습니까? –

답변

1

문제는 당신이 어떤 시점에서 설정하는 잘못된 프레임 크기 . 아마도 0 값을 가진 rect입니다.

코드에서 화면 크기를 묻는 중 예기치 않은 값이 다시 발생한다고 생각됩니다.

또한 이러한 오래된 애니메이션 기능을 사용하지 마십시오. 블록 기반 애니메이션을 사용하십시오. 훨씬 나아 졌어.