2011-07-06 14 views
0

AppleからPhotoPickerサンプルを実行しようとしましたが、4.0シミュレータでクラッシュしました。しかし、それは4.3の下でクラッシュしません。誰でもこの問題がありますか?この無限オブジェクトの問題を引き起こすSDKバージョン間で何か変更がありましたか?iOS PhotoPickerサンプルが4.0シミュレータでクラッシュする

それはこのラインで死ぬ:ここ

// as a delegate we are being told a picture was taken 
- (void)didTakePicture:(UIImage *)picture 
{ 
    [self.capturedImages addObject:picture]; 
} 

は、エラー出力されます:

GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC 2011) 
Copyright 2004 Free Software Foundation, Inc. 
GDB is free software, covered by the GNU General Public License, and you are 
welcome to change it and/or distribute copies of it under certain conditions. 
Type "show copying" to see the conditions. 
There is absolutely no warranty for GDB. Type "show warranty" for details. 
This GDB was configured as "x86_64-apple-darwin".Attaching to process 79426. 
2011-07-06 15:04:53.265 PhotoPicker[79426:207] Using two-stage rotation animation. To use the smoother single-stage animation, this application must remove two-stage method implementations. 
2011-07-06 15:04:53.268 PhotoPicker[79426:207] Using two-stage rotation animation is not supported when rotating more than one view controller or view controllers not the window delegate 
2011-07-06 15:04:56.432 PhotoPicker[79426:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableArray insertObject:atIndex:]: attempt to insert nil object at 0' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x0255a919 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x026a85de objc_exception_throw + 47 
    2 CoreFoundation      0x02554571 -[__NSArrayM insertObject:atIndex:] + 225 
    3 CoreFoundation      0x0254f9c4 -[__NSArrayM addObject:] + 68 
    4 PhotoPicker       0x00002d93 -[MyViewController didTakePicture:] + 65 
    5 PhotoPicker       0x00004442 -[OverlayViewController imagePickerController:didFinishPickingMediaWithInfo:] + 132 
    6 UIKit        0x00481a74 -[UIImagePickerController _imagePickerDidCompleteWithInfo:] + 139 
    7 PhotoLibrary      0x0c3c3070 PLNotifyImagePickerOfImageAvailability + 1746 
    8 PhotoLibrary      0x0c3d8891 -[PLUIAlbumViewController albumView:didTapPhotoAtIndex:] + 429 
    9 PhotoLibrary      0x0c426431 -[PLAlbumView _tapGesture:] + 385 
    10 UIKit        0x0052b394 -[UIGestureRecognizer _updateGestureWithEvent:] + 727 
    11 UIKit        0x00527bf3 -[UIGestureRecognizer _delayedUpdateGesture] + 47 
    12 UIKit        0x0052c486 _UIGestureRecognizerUpdateObserver + 637 
    13 UIKit        0x0052d798 _UIGestureRecognizerUpdateGesturesFromSendEvent + 51 
    14 UIKit        0x002dbbcd -[UIWindow _sendGesturesForEvent:] + 1292 
    15 UIKit        0x002d713a -[UIWindow sendEvent:] + 105 
    16 UIKit        0x002bb1ec -[UIApplication sendEvent:] + 447 
    17 UIKit        0x002bfac4 _UIApplicationHandleEvent + 7495 
    18 GraphicsServices     0x02dc0afa PurpleEventCallback + 1578 
    19 CoreFoundation      0x0253bdc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    20 CoreFoundation      0x0249c737 __CFRunLoopDoSource1 + 215 
    21 CoreFoundation      0x024999c3 __CFRunLoopRun + 979 
    22 CoreFoundation      0x02499280 CFRunLoopRunSpecific + 208 
    23 CoreFoundation      0x024991a1 CFRunLoopRunInMode + 97 
    24 GraphicsServices     0x02dbf2c8 GSEventRunModal + 217 
    25 GraphicsServices     0x02dbf38d GSEventRun + 115 
    26 UIKit        0x002c3b58 UIApplicationMain + 1160 
    27 PhotoPicker       0x000031f8 main + 102 
    28 PhotoPicker       0x000027bd start + 53 
    29 ???         0x00000001 0x0 + 1 
) 
terminate called after throwing an instance of 'NSException' 
sharedlibrary apply-load-rules all 
Current language: auto; currently objective-c 
(gdb) 
+0

動作確認済みです。あなたは何も変えなかった? – zpasternack

+0

私は何も変更しませんでした。それはとても奇妙なことです。私はそれを解凍し、それを走らせた。 – gonzobrains

答えて

0
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSMutableArray insertObject:atIndex:]: attempt to insert nil object at 0' 

あなたは配列にしてnilを挿入しよう。これはあなたがそれを行う[MyViewController didTakePicture:]

したがって、オブジェクトが配列のテストに追加する前に、それがnilである場合は最初に入力します。

+0

さて、私はApple(私ではない)のコードがこのようなことをしていると考えましたが、4.3シミュレータの下で動作するのは変です。 zpastermackは、彼が彼のために働くと報告した。 :/ – gonzobrains

1

私は、スタックトレースの最後の行として、通常PLAlbumViewまたはPLUIAlbumViewControllerのメソッドを使用して、フォトライブラリから画像を選択する際にiOS 4.3のシミュレータ/デバイスがランダムにクラッシュするという奇妙な問題を抱えていました。

私はモーダル写真・ビュー・コントローラを却下し、すぐに別のモーダルビューコントローラを提示した - これアニメーションはunnecessary.Theのクラッシュは、iOS 5

で起こっていなかったた私はそれが競合状態であったかもしれないと思いました、質問ごとPresenting a modal view controller immediately after dismissing another

は私が

[myPhotoLibrary dismissModalViewControllerAnimated:YES]; 

から

にVCを却下変更したときにことが判明したとして、 10
[myPhotoLibrary dismissModalViewControllerAnimated:NO]; 

クラッシュがなくなった。フレームワークのバグと思われます。

関連する問題