我的应用程序中有此代码:
[[self assetsLibrary] assetForURL:info.media.url resultBlock:^(ALAsset *asset) {
ALAssetRepresentation *rep = [asset defaultRepresentation];
CGImageRef img = [rep fullScreenImage];
photoLayer.contents = img;
} failureBlock:^(NSError *error) {
}];
代码到达填充 img 变量的行并停在那里,应用程序锁定且没有错误。NSLog 回显出一个大小,所以我知道资产在那里。我不知道如何解决这个问题,它以前工作过,但刚刚停止!有没有人看到这里有什么不合适的地方?
这是网址的样子:
assets-library://asset/asset.JPG?id=36E68169-7BB4-48D7-B8E1-244234C9F1DA&ext=JPG
冻结时的堆栈跟踪:
Thread 1, Queue : NSManagedObjectContext Queue
#0 0x37b1af38 in syscall_thread_switch ()
#1 0x331a5978 in OSSpinLockLock$VARIANT$wfe ()
#2 0x3318bcae in pthread_once ()
#3 0x348f66e2 in _internalCheckSupportsDCTDownScaling ()
#4 0x348f63fa in _initalizeService ()
#5 0x3318bcde in pthread_once ()
#6 0x348f63ba in jpegService ()
#7 0x3497009c in FigCreateCGImageFromJPEG ()
#8 0x356b5728 in PLCreateImageFromDataWithFormat ()
#9 0x35a3205e in __block_global_0 ()
#10 0x356a03f4 in -[PLAssetsSaver requestSynchronousImageFromAsset:withFormat:completionBlock:] ()
#11 0x35a32028 in __40-[ALAssetRepresentation fullScreenImage]_block_invoke_0 ()
#12 0x35a387ec in __53-[ALAssetRepresentationPrivate _performBlockAndWait:]_block_invoke_0 ()
#13 0x328e79a0 in developerSubmittedBlockToNSManagedObjectContextPerform ()
#14 0x3121c5da in _dispatch_client_callout ()
#15 0x3121f80e in _dispatch_barrier_sync_f_invoke ()
#16 0x328e7b22 in -[NSManagedObjectContext performBlockAndWait:] ()
#17 0x35a351b2 in -[ALAssetsLibrary _performBlockAndWait:] ()
#18 0x35a385ac in -[ALAssetRepresentationPrivate _performBlockAndWait:] ()
#19 0x35a31f24 in -[ALAssetRepresentation fullScreenImage] ()
#20 0x0008a3ca in __31-[MasterTimeLine getPhotoItem:]_block_invoke_0 at /Users/jasoncandelora/Desktop/Glance/iOS/projects/VideoBuilderTest1/VideoBuilderTest1/MasterTimeLine.m:789
#21 0x35a371b2 in __block_global_14 ()
#22 0x3121c792 in _dispatch_call_block_and_release ()
#23 0x3121c5da in _dispatch_client_callout ()
#24 0x3121fe44 in _dispatch_main_queue_callback_4CF ()
#25 0x357ff1b0 in __CFRunLoopRun ()
#26 0x3577223c in CFRunLoopRunSpecific ()
#27 0x357720c8 in CFRunLoopRunInMode ()
#28 0x3702133a in GSEventRunModal ()
#29 0x340ec290 in UIApplicationMain ()
#30 0x0006eda4 in main at /Users/jasoncandelora/Desktop/Glance/iOS/projects/VideoBuilderTest1/VideoBuilderTest1/main.m:16
Thread 3, Queue : com.apple.libdispatch-manager
#0 0x37b1b5d0 in kevent64 ()
#1 0x31221d26 in _dispatch_mgr_invoke ()
#2 0x3121d378 in _dispatch_mgr_thread ()
Thread 5 WebThread, Queue : (null)
#0 0x37b1ae30 in mach_msg_trap ()
#1 0x37b1afd4 in mach_msg ()
#2 0x358002ba in __CFRunLoopServiceMachPort ()
#3 0x357ff030 in __CFRunLoopRun ()
#4 0x3577223c in CFRunLoopRunSpecific ()
#5 0x357720c8 in CFRunLoopRunInMode ()
#6 0x3376ea5c in RunWebThread(void*) ()
#7 0x331950e0 in _pthread_start ()
#8 0x33194fa8 in thread_start ()
Thread 8 com.apple.coremedia.player.async, Queue : (null)
#0 0x37b2b08c in __psynch_cvwait ()
#1 0x3318db00 in _pthread_cond_wait ()
#2 0x33197cfc in pthread_cond_wait ()
#3 0x336ef8b8 in FigSemaphoreWaitRelative ()
#4 0x39b30eae in fpa_AsyncMovieControlThread ()
#5 0x3370d97a in figThreadMain ()
#6 0x331950e0 in _pthread_start ()
#7 0x33194fa8 in thread_start ()
Thread 9 com.apple.coremedia.player.remote, Queue : (null)
#0 0x37b1ae30 in mach_msg_trap ()
#1 0x37b1afd4 in mach_msg ()
#2 0x39b370d8 in FigExpressNotificationThread ()
#3 0x3370d97a in figThreadMain ()
#4 0x331950e0 in _pthread_start ()
#5 0x33194fa8 in thread_start ()