Menu
  • HOME
  • TAGS

Crash when toggling access to Camera and Photos [duplicate]

ios,avfoundation,photosframework

It's not a crash per se. The iOS system terminates every app system wide that has requested access to the Photo Library when that privacy flag is changed (including Apple System Apps). This originates due to a privacy change made in iOS 6. Look at page 24 in the WWDC...

Save UIImage to PHAssetCollection

ios,photosframework

In general you're doing things in the wrong order; you should not be doing any fetching inside a performChanges block. And you don't have to, in any case. Do not fetch the collection at all. Just create the photo, plain and simple, exactly as in your first line - except...

Photos API convert PHFetchResultChangeDetails indexes to NSMutableOrderedSet

ios,objective-c,nsset,photosframework,phphotolibrary

I've seemed to solve it (at least for now). I built my own removed, inserted, and changed indexes respectively, which isn't as efficient as the built in PHFetchResultChangeDetails ones, but I don't believe there's another way to do this. It takes about 4 seconds to chew through 2600 photos on...

PHFetchResult get all photos and sort by date inconsistent

ios,objective-c,photosframework,phphotolibrary,phfetchoptions

I figured this out on my own, here is my solution: - (void)setup { self.recentsDataSource = [[NSMutableOrderedSet alloc]init]; self.favoritesDataSource = [[NSMutableOrderedSet alloc]init]; PHFetchResult *assetCollection = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum | PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAny options:nil]; PHFetchResult *favoriteCollection = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum...

Filtering photo library by picture size with Photos framework

ios,swift,photosframework

Here is correct code. Note, that's instead of magic number 2 there's scale universal property because of iPhone 6 Plus has scale of 3. I also included landscape screenshots, thanks for the comments. Also, screen size formula was improved to prepare it for iOS 9 multitasking. var userScreenshots: PHFetchResult! let...

Grand Central Dispatch alternative to using an NSTimer - invalidating multiple times

ios,objective-c,grand-central-dispatch,photosframework

I figured this out quite simply with using dispatch_after Code: dispatch_source_t CreateTimerDispatchSource(uint64_t interval, uint64_t leeway, dispatch_queue_t queue, dispatch_block_t block) { dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); if (timer) { dispatch_source_set_timer(timer, dispatch_walltime(NULL, 0), DISPATCH_TIME_FOREVER, leeway); dispatch_source_set_event_handler(timer, block); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, interval), queue,^ { dispatch_resume(timer); }); }...

Photos Framework. requestImageForAsset returning two results. Can't set image view

ios,swift,uiimageview,uicollectionview,photosframework

Read header of PHImageManager class If -[PHImageRequestOptions isSynchronous] returns NO (or options is nil), resultHandler may be called 1 or more times. Typically in this case, resultHandler will be called asynchronously on the main thread with the requested results. However, if deliveryMode = PHImageRequestOptionsDeliveryModeOpportunistic, resultHandler may be called synchronously on...

PHPhotoLibrary change observer not called

ios,objective-c,photosframework,phphotolibrary

I think there is something wrong with how you are testing. It works fine for me. Here's what I did. This is the entire code of my one view controller: #import <UIKit/UIKit.h> @import Photos; #import "ViewController.h" @interface ViewController() <PHPhotoLibraryChangeObserver> @end @implementation ViewController : UIViewController - (void)viewDidLoad { [super viewDidLoad]; [PHPhotoLibrary...

PHPhotoLibrary get album names

ios,objective-c,alassetslibrary,photosframework,phphotolibrary

This is how I made a list of the album names in a project of mine. You may have to deviate a bit, but this should work. NSArray *collectionsFetchResults; NSMutableArray *localizedTitles = [[NSMutableArray alloc] init]; PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum subtype:PHAssetCollectionSubtypeAlbumRegular options:nil]; PHFetchResult *syncedAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAlbumSyncedAlbum...

iOS Photos Framework data UTI or format when image is in cloud

ios,objective-c,photosframework

Looks like there just isn't a way to figure this out without pulling down the images from the cloud and checking after. I'm updating my app to do that but to remember the type of each image against the PHAsset's localIdentifier so that it only needs to do it once....

Photokit preserve user album list order

ios,objective-c,photokit,photosframework

Sorry, but I don't think it's possible actually (I hope in some upgrades). In fact, it is possible to use PHFetchOptions to sort asset collections, but PhotoKit supports only a restricted set of keys for the predicate and sortDescriptors properties (see PHFetchOptions) and between these I can't see a key...