崩潰我用下面的代碼初始化的UIWebView實例:UIWebView的初始化iPad上
-(void)viewDidLoad {
[super viewDidLoad];
UIWebView *webView;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 768, 964)]; //crash
} else {
webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 380)];
}
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;
}
這是非常奇怪的,上面的代碼是在iPhone模擬器上工作,但它會崩潰在iPad模擬器。我的xcode是3.2.4。你能否提供任何線索?提前致謝!
崩潰日誌:
0 flushCaches 0x031b5574
#1 0x031b38fc在_read_images3 map_images_nolock 0x031c3784 remethodizeClass
#2 0x031b60ea
#4 0x031b5724在map_images
#5 0x8fe03f2d在__dyld__ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoE
6 0x8fe0decd在__dyld__ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE在__dyld__ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
7 0x8fe056af#8在__dyld_dlopen
#9 0x9754a868中的dlopen
#10 0x0063b8e6在initWebUILocalStorageSupport
#11 0x0063a0d6 0x8fe0b242 - [UIWebView的_webViewCommonInit:]
#12 0x0063abfd在 - [UIWebView initWithFrame:]
#13 0x0002c467 in - [WebViewControllerviewDidLoad] at WebViewController.m:55
#14 0x00525f85在 - [UIViewController的視圖]
在#15 0x0052439f - [UIViewController中contentScrollView]在
#16 0x00532fee - [UINavigationController的 _computeAndApplyScrollContentInsetDeltaForViewController:]
#17 0x00531f40在 - [UINavigationController的_layoutViewController:]在
#18 0x00533f39 - [UINavigationController的_startTransition:fromViewController:toViewController:]
#19 0x0052dfa1在 - [UINavigationController的_startDeferredTransitionIfNeeded]
#20 0x00673c8a在 - [UILayoutContainerView layoutSubviews]
#21 0x02b10916在 - [CALayer的layoutSublayers]
#22 0x02b10625在CALayerLayoutIfNeeded
#23 0x02b3b0e7在 - [CALayer layoutIfNeeded]
#24 0x00527296在 - [UIViewController中 窗口:willAnimateRotationToInterfaceOrientation:持續時間:]25 0x004afef1在 - [一個UIWindow _setRotatableClient:toOrientation:持續時間:力:]
#26 0x00736425在 - [UIWindowController過渡:fromViewController:toViewController:目標:didEndSelector:]27 0x005297ac在 - [UIViewController中presentModalViewController:withTransition:]
#28 0x00522e70在- [UIViewController中_tryRecursivelyPresentModalViewController:withTransition:]
#29 0x0052901d在 - [UIViewController presentModalViewController:withTransition:]
#30 0x0002b8b4在 - [TweetViewController showLocation:]在TweetViewController。m:608
#31 0x0048dcee in - [UIApplication sendAction:to:from:forEvent:]
#32 0x0050743e in - [UIControl sendAction:to:forEvent:]
#33 0x005098c0 in - [UIControl(Internal)_sendActionsForEvents:withEvent: ]
#34 0x0050846d在 - [UIControl touchesEnded:withEvent:方法]
#35 0x0071aaad在
#36 0x03016a52在__CFRunLoopDoObservers
#37 0x02fe3345在CFRunLoopRunSpecific
#38 0x02fe28a8在CFRunLoopRunInMode _UIGestureRecognizerUpdateObserver39 0x034d089d在GSEventRunModal
# 40 GSEventRun中的0x034d0962
#41 0x00498372 in UIApplicationMain42主0x00002dd8在main.m文件:14
請給我們提供崩潰日誌。代碼本身看起來很好。 – SteamTrout 2010-10-15 13:51:47
@Schot,感謝格式 – mobguang 2010-10-15 14:10:28
看起來像別的東西導致崩潰...,同意流鱒魚。無論如何,如果它的指針初始化局部變量爲零,通常是個好主意。 – SegFault 2010-10-15 14:13:50