I have some code that wraps an ALAsset object that is retrieved from enumerating the assets in an ALAssetLibrary. I'm getting reports of users encountering crashes with the part of the wrapper object that asks the ALAsset it contains for metadata.
The code that crashes is in this wrapper class and it simply asks for its ALAsset's metadata like so:
[[myAlAsset defaultRepresentation] metadata];
Here is a partial stack trace that is representative of the crashes I'm seeing:
0
CoreFoundation CFDataGetBytePtr + 5
1
PhotoLibraryServices __46-[PLManagedAsset adjustmentsXMPRepresentation]_block_invoke + 228
2
PhotoLibraryServices __46-[PLManagedAsset adjustmentsXMPRepresentation]_block_invoke + 228
3
CoreData developerSubmittedBlockToNSManagedObjectContextPerform + 88
4
CoreData -[NSManagedObjectContext performBlockAndWait:] + 114
5
PhotoLibraryServices -[PLManagedAsset adjustmentsXMPRepresentation] + 226
6
AssetsLibrary __33-[ALAssetRepresentation metadata]_block_invoke + 24
7
AssetsLibrary __53-[ALAssetRepresentationPrivate _performBlockAndWait:]_block_invoke + 68
8
CoreData developerSubmittedBlockToNSManagedObjectContextPerform + 88
9
libdispatch.dylib _dispatch_client_callout + 22
10
libdispatch.dylib _dispatch_barrier_sync_f_invoke + 26
11
CoreData -[NSManagedObjectContext performBlockAndWait:] + 106
12
AssetsLibrary -[ALAssetsLibrary _performBlockAndWait:] + 134
13
AssetsLibrary -[ALAssetRepresentationPrivate _performBlockAndWait:] + 176
14
AssetsLibrary -[ALAssetRepresentation metadata] + 464
Does anyone have ideas on what may be going on? The AlAssetLibrary that underlies these assets is saved with a static reference, so it should not be getting cleaned up in memory and so I wouldn't expect the ALAsset to have been invalidated. This issue seems to have started specifically with iOS 7 being released.
The crash itself is EXC_BAD_ACCESS with KERN_INVALID_ADDRESS at 0x0.
CFDataGetBytePtr
at top of the stack, I feel this might be memory-related. Have you found the cause/solution for this? – SilinALAssetsGroupSavedPhotos
andALAssetsGroupAlbum
so we can rule out the photo stream and other special folders. – Silin