j'ai utilisé le code suivant pour initialiser instance de UIWebView:UIWebView crash sur 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;
}
Il est très étrange, au-dessus du code est un travail sur simulateur d'iPhone, mais il se bloque sur simulateur ipad. Mon xcode est 3.2.4. Pourriez-vous s'il vous plaît fournir un indice? Merci d'avance!
journal Crash:
0 0x031b5574 dans flushCaches
# 1 0x031b38fc dans remethodizeClass
# 2 0x031b60ea dans _read_images3 0x031c3784 dans map_images_nolock
# 4 0x031b5724 à map_images
# 5 0x8fe03f2d à__dyld__ZN4dyldL18notifyBatchPartialE17dyld_image_statesbPFPKcS0_jPK15dyld_image_infoF
6 0x8fe0decd dans __dyld__ZN11ImageLoader4linkERKNS_11LinkContextEbbRKNS_10RPathChainE
7 0x8fe056af dans __dyld__ZN4dyld4linkEP11ImageLoaderbRKNS0_10RPathChainE
# 8 0x8fe0b242 dans __dyld_dlopen
# 9 0x9754a868 dans dlopen
# 10 0x0063b8e6 dans initWebUILocalStorageSupport
# 11 0x0063a0d6 dans - [UIWebView _webViewCommonInit:]
# 12 0x0063abfd dans - [UIWebView initWithFrame:]
# 13 0x0002c467 dans - [WebViewControllerviewDidLoad] à WebViewController.m: 55
# 14 0x00525f85 dans - [voir UIViewController]
# 15 0x0052439f dans - [UIViewController contentScrollView]
# 16 0x00532fee dans - [UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:]
# 17 0x00531f40 dans - [UINavigationController _layoutViewController:]
# 18 0x00533f39 en - [UINavigationController _startTransition: fromViewController: toViewController:]
# 19 0x0052dfa1 dans - [UINavigationController _startDeferredTransitionIfNeeded]
# 20 0x00673c8a dans - [UILayoutContainerView layoutSubviews]
# 21 0x02b10916 dans - [CALayer layoutSublayers]
# 22 0x02b10625 dans CALayerLayoutIfNeeded
# 23 0x02b3b0e7 dans - [CALayer layoutIfNeeded]
# 24 0x00527296 dans - [fenêtre UIViewController : willAnimateRotationToInterfaceOrientation: durée:]25 0x004afef1 dans - [UIWindow _setRotatableClient: toOrientation: durée: Force:]
# 26 0x00736425 dans - [transition UIWindowController: fromViewController: toViewController: objectif: didEndSelector:]27 0x005297ac en - [UIViewController presentModalViewController: withTransition:]
# 28 0x00522e70 dans- [UIViewController _tryRecursivelyPresentModalViewController: withTransition:]
# 29 0x0052901d dans - [UIViewController presentModalViewController: withTransition:]
# 30 0x0002b8b4 dans - [TweetViewController showLocation:] à TweetViewController.m: 608
# 31 0x0048dcee in - [UIApplication sendAction: à: de: forEvent:]
# 32 0x0050743e in - [UIControl sendAction: à: forEvent:]
# 33 0x005098c0 in - [UIControl (interne) _sendActionsForEvents: withEvent: ]
# 34 0x0050846d dans - [UIControl touchesEnded: withEvent:]
# 35 0x0071aaad dans _UIGestureRecognizerUpdateObserver
# 36 0x03016a52 dans __CFRunLoopDoObservers
# 37 0x02fe3345 dans CFRunLoopRunSpecific
# 38 0x02fe28a8 dans CFRunLoopRunInMode39 0x034d089d dans GSEventRunModal
# 40 0x034d0962 dans GSEventRun
# 41 0x00498372 dans UIApplicationMain42 0x00002dd8 dans le principal à main.m: 14
Veuillez nous fournir le journal de bord. Le code lui-même semble bien. – SteamTrout
@Schot, merci pour le formatage – mobguang
On dirait que quelque chose d'autre provoque un crash ..., d'accord avec Stream Trout. Quoi qu'il en soit, il est généralement bon d'initialiser les variables locales à zéro si c'est un pointeur. – SegFault