iPhone应用程序在设备上崩溃但不是模拟器.使用UIWebView访问本地
发布时间:2020-12-14 17:37:02 所属栏目:百科 来源:网络整理
导读:我希望你们可以帮助我,我的代码有什么问题导致我的应用程序在我的设备上崩溃而不是模拟器.这是一个非常简单的应用程序,我只是在UIWebView中显示本地文件.这是我在我的.m中使用的内容 NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofTy
我希望你们可以帮助我,我的代码有什么问题导致我的应用程序在我的设备上崩溃而不是模拟器.这是一个非常简单的应用程序,我只是在UIWebView中显示本地文件.这是我在我的.m中使用的内容
NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"localHTML/mobile"]; NSURL *url = [NSURL fileURLWithPath:path]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView loadRequest:request]; 我只发布这段代码,因为我觉得这里的某些东西导致了这个问题,但是我知道什么,如果你需要看别的东西,请告诉我. 这是崩溃日志.其中一些可能没有帮助,但我想我会发布整个事情,因为我不知道该寻找什么. Incident Identifier: 9598C96E-EA38-4C54-B39F-BBD245648E48 CrashReporter Key: cb7605a41daea519012d6fd4f52c4b19fb584743 Hardware Model: iPhone3,1 Process: Cannon Mobile [5129] Path: /var/mobile/Applications/E5760D01-689A-41A3-A6CA-45E007B7C27A/Cannon Mobile.app/Cannon Mobile Identifier: Cannon Mobile Version: ??? (???) Code Type: ARM (Native) Parent Process: launchd [1] Date/Time: 2011-09-30 19:26:57.951 -0400 OS Version: iPhone OS 4.3.3 (8J2) Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000,0x00000000 Crashed Thread: 0 Thread 0 name: Dispatch queue: com.apple.main-thread Thread 0 Crashed: 0 libsystem_kernel.dylib 0x3558fa1c __pthread_kill + 8 1 libsystem_c.dylib 0x356663b4 pthread_kill + 52 2 libsystem_c.dylib 0x3565ebf8 abort + 72 3 libstdc++.6.dylib 0x35628a64 __gnu_cxx::__verbose_terminate_handler() + 376 4 libobjc.A.dylib 0x3449d06c _objc_terminate + 104 5 libstdc++.6.dylib 0x35626e36 __cxxabiv1::__terminate(void (*)()) + 46 6 libstdc++.6.dylib 0x35626e8a std::terminate() + 10 7 libstdc++.6.dylib 0x35626f5a __cxa_throw + 78 8 libobjc.A.dylib 0x3449bc84 objc_exception_throw + 64 9 CoreFoundation 0x3098048a +[NSException raise:format:arguments:] + 62 10 CoreFoundation 0x309804c4 +[NSException raise:format:] + 28 11 Foundation 0x341dd188 -[NSURL(NSURL) initFileURLWithPath:] + 64 12 Foundation 0x341dd128 +[NSURL(NSURL) fileURLWithPath:] + 24 13 Cannon Mobile 0x000033da -[Cannon_MobileViewController refresh:] (Cannon_MobileViewController.m:48) 14 Cannon Mobile 0x000034ec -[Cannon_MobileViewController viewDidLoad] (Cannon_MobileViewController.m:62) 15 UIKit 0x30a18f08 -[UIViewController view] + 104 16 UIKit 0x30a172ae -[UIWindow addRootViewControllerViewIfPossible] + 26 17 UIKit 0x30b42538 -[UIWindow setRootViewController:] + 160 18 Cannon Mobile 0x00002fb6 -[Cannon_MobileAppDelegate application:didFinishLaunchingWithOptions:] (Cannon_MobileAppDelegate.m:22) 19 UIKit 0x30a1781a -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 766 20 UIKit 0x30a11b5e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 266 21 UIKit 0x309e67d0 -[UIApplication handleEvent:withNewEvent:] + 1108 22 UIKit 0x309e620e -[UIApplication sendEvent:] + 38 23 UIKit 0x309e5c4c _UIApplicationHandleEvent + 5084 24 GraphicsServices 0x30269e70 PurpleEventCallback + 660 25 CoreFoundation 0x30957a90 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 20 26 CoreFoundation 0x30959838 __CFRunLoopDoSource1 + 160 27 CoreFoundation 0x3095a606 __CFRunLoopRun + 514 28 CoreFoundation 0x308eaebc CFRunLoopRunSpecific + 224 29 CoreFoundation 0x308eadc4 CFRunLoopRunInMode + 52 30 UIKit 0x30a10d42 -[UIApplication _run] + 366 31 UIKit 0x30a0e800 UIApplicationMain + 664 32 Cannon Mobile 0x00002f20 main (main.m:14) 33 Cannon Mobile 0x00002ec8 start + 32 Thread 1: 0 libsystem_kernel.dylib 0x355903ec __workq_kernreturn + 8 1 libsystem_c.dylib 0x356676d8 _pthread_wqthread + 592 2 libsystem_c.dylib 0x35667bbc start_wqthread + 0 Thread 2 name: Dispatch queue: com.apple.libdispatch-manager Thread 2: 0 libsystem_kernel.dylib 0x35590fbc kevent + 24 1 libdispatch.dylib 0x35261032 _dispatch_mgr_invoke + 706 2 libdispatch.dylib 0x3526203a _dispatch_queue_invoke + 86 3 libdispatch.dylib 0x352615ea _dispatch_worker_thread2 + 186 4 libsystem_c.dylib 0x3566758a _pthread_wqthread + 258 5 libsystem_c.dylib 0x35667bbc start_wqthread + 0 Thread 3 name: WebThread Thread 3: 0 libsystem_kernel.dylib 0x3558dc5c semaphore_wait_signal_trap + 8 1 libsystem_kernel.dylib 0x3558df52 semaphore_wait_signal + 2 2 libsystem_c.dylib 0x35664734 pthread_mutex_lock + 256 3 WebCore 0x35f533ee _ZL17_WebTryThreadLockb + 150 4 WebCore 0x35f5332e _ZL14WebRunLoopLockP19__CFRunLoopObservermPv + 14 5 CoreFoundation 0x30957a2e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 10 6 CoreFoundation 0x3095945e __CFRunLoopDoObservers + 406 7 CoreFoundation 0x3095a760 __CFRunLoopRun + 860 8 CoreFoundation 0x308eaebc CFRunLoopRunSpecific + 224 9 CoreFoundation 0x308eadc4 CFRunLoopRunInMode + 52 10 WebCore 0x35f5327e _ZL12RunWebThreadPv + 382 11 libsystem_c.dylib 0x3566630a _pthread_start + 242 12 libsystem_c.dylib 0x35667bb4 thread_start + 0 Thread 0 crashed with ARM Thread State: r0: 0x00000000 r1: 0x00000000 r2: 0x00000001 r3: 0x00000000 r4: 0x3f86348c r5: 0x00000006 r6: 0x1d59051c r7: 0x2fe10f90 r8: 0x3ed19bf8 r9: 0x00000065 r10: 0x3180e2f0 r11: 0x3ed0c964 ip: 0x00000148 sp: 0x2fe10f84 lr: 0x3619b3bb pc: 0x360c4a1c cpsr: 0x00000010 非常感谢你的帮助. 解决方法
检查Xcode生成的应用程序包.它是否包含localHTML / mobile目录以及您期望的所有文件?
(右键单击Xco??de导航器面板中Products部分下的appname.app,选择’Finder中显示’,然后右键单击Finder中的应用程序包并选择’显示包内容’) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |