dragoncherry / assetspickerviewcontroller Goto Github PK
View Code? Open in Web Editor NEWPowerfully Customizable - Multiple Photo & Video Picker Controller
License: MIT License
Powerfully Customizable - Multiple Photo & Video Picker Controller
License: MIT License
选中了一张照片后,怎么预览这张照片?
The current state assumes the selected thumbnails also exist in the User's phone, but sometimes they need to be downloaded from iCloud. If the downloading fails, which happens quite a lot, then no image is being stored. Some kind of safe logic preventing this to happen would be cool!
Thanks for the hard work!
Hello,
I have started to implement the AssetsPickerViewController and have been able to assign a custom color to the navigationBar of the Photo Screen (where all photos of an album are displayed). However, when the user changes the album, the nav bar of the album page is still apples light blue. I wanted to ask
a) how I can change the color of the album overview screen as well
and
b) how I can change the color of the selection checkmarks
I used the following code:
picker.navigationBar.tintColor = .red
Thanks for your help!
Attached you can find screenshots of what I mean :)
The logs are very annoying, is there a way to shut it down?
I tried to install AssetsPickerViewController using cocoapods.
But it installs other several libraries such as Dimmer, FadeVeiw and OptionalTypes.
I got following issues.
Analyzing dependencies
Pre-downloading: AssetsPickerViewController
from https://github.com/DragonCherry/AssetsPickerViewController
, branch swift3
Downloading dependencies
Installing AssetsPickerViewController (1.1.1)
Installing Dimmer (1.0.0)
Installing FadeView (1.0.2)
Installing OptionalTypes (1.0.3)
[!] Error installing OptionalTypes
[!] /usr/bin/git clone https://github.com/DragonCherry/OptionalTypes.git /var/folders/mn/mv6kczj973g5lk2495jb5hgr0000gn/T/d20170708-22171-brgj2f --template= --single-branch --depth 1 --branch 1.0.3
Cloning into '/var/folders/mn/mv6kczj973g5lk2495jb5hgr0000gn/T/d20170708-22171-brgj2f'...
warning: Could not find remote branch 1.0.3 to clone.
fatal: Remote branch 1.0.3 not found in upstream origin
How can I solve this problem.
I am using Xcode 8.3.2 in iOS 10.12.4
Regards
We share the crash that's happening to us.
I hope this will help you.
Thank you.
#0. Crashed: com.apple.main-thread
0 AssetsPickerViewController 0x1032c6760 AssetsPhotoViewController.setupAssets() (AssetsManager.swift:473)
1 AssetsPickerViewController 0x1032c6350 closure #1 in AssetsPhotoViewController.viewDidLoad() (AssetsPhotoViewController.swift:127)
2 AssetsPickerViewController 0x1032c0bb0 partial apply for closure #1 in closure #1 in AssetsManager.authorize(completion:) (AssetsManager.swift:149)
3 AssetsPickerViewController 0x1032c45f0 thunk for @escaping @callee_guaranteed () -> () ()
4 libdispatch.dylib 0x224d9d6c8 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x224d9e484 _dispatch_client_callout + 16
6 libdispatch.dylib 0x224d4a9a4 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1068
7 CoreFoundation 0x2252f4df4 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12
8 CoreFoundation 0x2252efcbc __CFRunLoopRun + 1964
9 CoreFoundation 0x2252ef1f0 CFRunLoopRunSpecific + 436
10 GraphicsServices 0x227568584 GSEventRunModal + 100
11 UIKitCore 0x25267ad40 UIApplicationMain + 212
12 TheDayCouple 0x102674890 main (main.m:15)
13 libdyld.dylib 0x224daebb4 start + 4
--
#0. Crashed: com.apple.main-thread
0 AssetsPickerViewController 0x1032c6760 AssetsPhotoViewController.setupAssets() (AssetsManager.swift:473)
1 AssetsPickerViewController 0x1032c6350 closure #1 in AssetsPhotoViewController.viewDidLoad() (AssetsPhotoViewController.swift:127)
2 AssetsPickerViewController 0x1032c0bb0 partial apply for closure #1 in closure #1 in AssetsManager.authorize(completion:) (AssetsManager.swift:149)
3 AssetsPickerViewController 0x1032c45f0 thunk for @escaping @callee_guaranteed () -> () ()
4 libdispatch.dylib 0x224d9d6c8 _dispatch_call_block_and_release + 24
5 libdispatch.dylib 0x224d9e484 _dispatch_client_callout + 16
6 libdispatch.dylib 0x224d4a9a4 _dispatch_main_queue_callback_4CF$VARIANT$mp + 1068
7 CoreFoundation 0x2252f4df4 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 12
8 CoreFoundation 0x2252efcbc __CFRunLoopRun + 1964
9 CoreFoundation 0x2252ef1f0 CFRunLoopRunSpecific + 436
10 GraphicsServices 0x227568584 GSEventRunModal + 100
11 UIKitCore 0x25267ad40 UIApplicationMain + 212
12 TheDayCouple 0x102674890 main (main.m:15)
13 libdyld.dylib 0x224daebb4 start + 4
#1. Thread
0 libsystem_kernel.dylib 0x224efbb9c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x224f81100 _pthread_wqthread + 348
2 libsystem_pthread.dylib 0x224f83cec start_wqthread + 4
#2. com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x224eefea4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x224eef37c mach_msg + 72
2 CoreFoundation 0x2252f4be8 __CFRunLoopServiceMachPort + 236
3 CoreFoundation 0x2252efa84 __CFRunLoopRun + 1396
4 CoreFoundation 0x2252ef1f0 CFRunLoopRunSpecific + 436
5 Foundation 0x225ce5494 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300
6 Foundation 0x225ce5340 -[NSRunLoop(NSRunLoop) runUntilDate:] + 148
7 UIKitCore 0x25276b1f4 + 136
8 Foundation 0x225e1823c NSThread__start + 1040
9 libsystem_pthread.dylib 0x224f8025c _pthread_body + 128
10 libsystem_pthread.dylib 0x224f801bc _pthread_start + 48
11 libsystem_pthread.dylib 0x224f83cf4 thread_start + 4
#3. com.twitter.crashlytics.ios.MachExceptionServer
0 TheDayCouple 0x102745180 CLSProcessRecordAllThreads + 4296511872
1 TheDayCouple 0x102745568 CLSProcessRecordAllThreads + 4296512872
2 TheDayCouple 0x102734de4 CLSHandler + 4296445412
3 TheDayCouple 0x1027301c4 CLSMachExceptionServer + 4296425924
4 libsystem_pthread.dylib 0x224f8025c _pthread_body + 128
5 libsystem_pthread.dylib 0x224f801bc _pthread_start + 48
6 libsystem_pthread.dylib 0x224f83cf4 thread_start + 4
#4. JavaScriptCore bmalloc scavenger
0 libsystem_kernel.dylib 0x224efaf0c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x224f78c88 _pthread_cond_wait$VARIANT$mp + 636
2 libc++.1.dylib 0x2244c84d0 std::__1::condition_variable::wait(std::__1::unique_lockstd::__1::mutex&) + 24
3 JavaScriptCore 0x22c6a69c8 void std::__1::condition_variable_any::wait<std::__1::unique_lockbmalloc::Mutex >(std::__1::unique_lockbmalloc::Mutex&) + 104
4 JavaScriptCore 0x22c6aaabc bmalloc::Scavenger::threadRunLoop() + 176
5 JavaScriptCore 0x22c6aa1f0 bmalloc::Scavenger::Scavenger(std::__1::lock_guardbmalloc::Mutex&) + 10
6 JavaScriptCore 0x22c6abc9c std::__1::__thread_specific_ptrstd::__1::__thread_struct::set_pointer(std::__1::__thread_struct*) + 38
7 libsystem_pthread.dylib 0x224f8025c _pthread_body + 128
8 libsystem_pthread.dylib 0x224f801bc _pthread_start + 48
9 libsystem_pthread.dylib 0x224f83cf4 thread_start + 4
#5. WebThread
0 libsystem_kernel.dylib 0x224eefea4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x224eef37c mach_msg + 72
2 CoreFoundation 0x2252f4be8 __CFRunLoopServiceMachPort + 236
3 CoreFoundation 0x2252efa84 __CFRunLoopRun + 1396
4 CoreFoundation 0x2252ef1f0 CFRunLoopRunSpecific + 436
5 WebCore 0x22e15eeec RunWebThread(void*) + 592
6 libsystem_pthread.dylib 0x224f8025c _pthread_body + 128
7 libsystem_pthread.dylib 0x224f801bc _pthread_start + 48
8 libsystem_pthread.dylib 0x224f83cf4 thread_start + 4
#6. GAIThread
0 libsystem_kernel.dylib 0x224eefea4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x224eef37c mach_msg + 72
2 CoreFoundation 0x2252f4be8 __CFRunLoopServiceMachPort + 236
3 CoreFoundation 0x2252efa84 __CFRunLoopRun + 1396
4 CoreFoundation 0x2252ef1f0 CFRunLoopRunSpecific + 436
5 Foundation 0x225ce5494 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 300
6 Foundation 0x225d20e84 -[NSRunLoop(NSRunLoop) run] + 88
7 TheDayCouple 0x10270ff2c +[GAI threadMain:] + 4296294188
8 Foundation 0x225e1823c NSThread__start + 1040
9 libsystem_pthread.dylib 0x224f8025c _pthread_body + 128
10 libsystem_pthread.dylib 0x224f801bc _pthread_start + 48
11 libsystem_pthread.dylib 0x224f83cf4 thread_start + 4
#7. com.apple.CoreMotion.MotionThread
0 libsystem_kernel.dylib 0x224eefea4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x224eef37c mach_msg + 72
2 CoreFoundation 0x2252f4be8 __CFRunLoopServiceMachPort + 236
3 CoreFoundation 0x2252efa84 __CFRunLoopRun + 1396
4 CoreFoundation 0x2252ef1f0 CFRunLoopRunSpecific + 436
5 CoreFoundation 0x2252eff8c CFRunLoopRun + 80
6 CoreMotion 0x22ad45c58 (Missing)
7 libsystem_pthread.dylib 0x224f8025c _pthread_body + 128
8 libsystem_pthread.dylib 0x224f801bc _pthread_start + 48
9 libsystem_pthread.dylib 0x224f83cf4 thread_start + 4
#8. AVAudioSession Notify Thread
0 libsystem_kernel.dylib 0x224eefea4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x224eef37c mach_msg + 72
2 CoreFoundation 0x2252f4be8 __CFRunLoopServiceMachPort + 236
3 CoreFoundation 0x2252efa84 __CFRunLoopRun + 1396
4 CoreFoundation 0x2252ef1f0 CFRunLoopRunSpecific + 436
5 AVFAudio 0x22b30260c GenericRunLoopThread::Entry(void*) + 164
6 AVFAudio 0x22b32e768 CAPThread::Entry(CAPThread*) + 88
7 libsystem_pthread.dylib 0x224f8025c _pthread_body + 128
8 libsystem_pthread.dylib 0x224f801bc _pthread_start + 48
9 libsystem_pthread.dylib 0x224f83cf4 thread_start + 4
#9. com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x224eefea4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x224eef37c mach_msg + 72
2 CoreFoundation 0x2252f4be8 __CFRunLoopServiceMachPort + 236
3 CoreFoundation 0x2252efa84 __CFRunLoopRun + 1396
4 CoreFoundation 0x2252ef1f0 CFRunLoopRunSpecific + 436
5 CFNetwork 0x22591200c -[__CoreSchedulingSetRunnable runForever] + 212
6 Foundation 0x225e1823c NSThread__start + 1040
7 libsystem_pthread.dylib 0x224f8025c _pthread_body + 128
8 libsystem_pthread.dylib 0x224f801bc _pthread_start + 48
9 libsystem_pthread.dylib 0x224f83cf4 thread_start + 4
#10. Thread
0 libsystem_kernel.dylib 0x224efbb9c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x224f81100 _pthread_wqthread + 348
2 libsystem_pthread.dylib 0x224f83cec start_wqthread + 4
#11. WebCore: LocalStorage
0 libsystem_kernel.dylib 0x224efaf0c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x224f78c88 _pthread_cond_wait$VARIANT$mp + 636
2 JavaScriptCore 0x22c694b14 WTF::ThreadCondition::timedWait(WTF::Mutex&, WTF::WallTime) + 80
3 JavaScriptCore 0x22c67bd20 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, WTF::TimeWithDynamicClockType const&) + 2004
4 WebKitLegacy 0x22f5e4180 bool WTF::Condition::waitUntilWTF::Lock(WTF::Lock&, WTF::TimeWithDynamicClockType const&) + 184
5 WebKitLegacy 0x22f5e6e24 std::__1::unique_ptr<WTF::Function<void ()>, std::__1::default_delete<WTF::Function<void ()> > > WTF::MessageQueue<WTF::Function<void ()> >::waitForMessageFilteredWithTimeout<WTF::MessageQueue<WTF::Function<void ()> >::waitForMessage()::'lambda'(WTF::Function<void ()> const&)>(WTF::MessageQueueWaitResult&, WTF::MessageQueue<WTF::Function<void ()> >::waitForMessage()::'lambda'(WTF::Function<void ()> const&)&&, WTF::WallTime) + 156
6 WebKitLegacy 0x22f5e643c WebCore::StorageThread::threadEntryPoint() + 68
7 JavaScriptCore 0x22c692d70 WTF::Thread::entryPoint(WTF::Thread::NewThreadContext*) + 256
8 JavaScriptCore 0x22c6942d8 WTF::wtfThreadEntryPoint(void*) + 12
9 libsystem_pthread.dylib 0x224f8025c _pthread_body + 128
10 libsystem_pthread.dylib 0x224f801bc _pthread_start + 48
11 libsystem_pthread.dylib 0x224f83cf4 thread_start + 4
#12. Thread
0 libsystem_kernel.dylib 0x224efbb9c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x224f81100 _pthread_wqthread + 348
2 libsystem_pthread.dylib 0x224f83cec start_wqthread + 4
#13. Thread
0 libsystem_kernel.dylib 0x224efbb9c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x224f81100 _pthread_wqthread + 348
2 libsystem_pthread.dylib 0x224f83cec start_wqthread + 4
#14. com.apple.CFNetwork.CustomProtocols
0 libsystem_kernel.dylib 0x224eefea4 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x224eef37c mach_msg + 72
2 CoreFoundation 0x2252f4be8 __CFRunLoopServiceMachPort + 236
3 CoreFoundation 0x2252efa84 __CFRunLoopRun + 1396
4 CoreFoundation 0x2252ef1f0 CFRunLoopRunSpecific + 436
5 CFNetwork 0x22591200c -[__CoreSchedulingSetRunnable runForever] + 212
6 Foundation 0x225e1823c NSThread__start + 1040
7 libsystem_pthread.dylib 0x224f8025c _pthread_body + 128
8 libsystem_pthread.dylib 0x224f801bc _pthread_start + 48
9 libsystem_pthread.dylib 0x224f83cf4 thread_start + 4
#15. com.apple.libtrace.state.block-list
0 libsystem_kernel.dylib 0x224efb9fc __ulock_wait + 8
1 libdispatch.dylib 0x224d3f238 _dispatch_ulock_wait + 56
2 libdispatch.dylib 0x224d3f370 _dispatch_thread_event_wait_slow$VARIANT$mp + 48
3 libdispatch.dylib 0x224d4b880 DISPATCH_WAIT_FOR_QUEUE + 340
4 libdispatch.dylib 0x224d4b484 _dispatch_sync_f_slow + 144
5 libsystem_trace.dylib 0x224fa3940 _os_state_request_for_self_impl + 320
6 libsystem_trace.dylib 0x224fa37e8 ___os_state_request_for_self_block_invoke + 48
7 libdispatch.dylib 0x224d9d6c8 _dispatch_call_block_and_release + 24
8 libdispatch.dylib 0x224d9e484 _dispatch_client_callout + 16
9 libdispatch.dylib 0x224d45bd0 _dispatch_lane_serial_drain$VARIANT$mp + 592
10 libdispatch.dylib 0x224d4674c _dispatch_lane_invoke$VARIANT$mp + 484
11 libdispatch.dylib 0x224d4eeb8 _dispatch_workloop_worker_thread + 600
12 libsystem_pthread.dylib 0x224f810dc _pthread_wqthread + 312
13 libsystem_pthread.dylib 0x224f83cec start_wqthread + 4
When I run a project with AssetsPickerViewController in a language other than English, the language in AssetsPickerViewController is still English. How do I match the language to the device language?
Please update to be able to use this with swift 4.2
There should be an option to select only images, currently both videos and images are listed
I have an odd kind of question. I have 2 View Controllers. View controller 1 presents the user with a action sheet where they can choose between camera and camera roll options. Once the user select camera roll, the app presents the AssetsPickerViewController. So far all good. Once they select multiple assets, those assets are being transferred to View Controller 2 that turns them into images and populate UICollectionViewCells with all selected images.
My question is, how can I allow the user to go back and select more assets? I tried the following, but it's not working:
let postStoryboard = UIStoryboard(name: Storyboard_Post, bundle:nil)
if let postVC = postStoryboard.instantiateViewController(withIdentifier: "ViewController1") as? ViewController1
{
let assetsPicker = AssetsPickerViewController()
assetsPicker.pickerDelegate = self
ViewController1.present(assetsPicker, animated: true, completion: nil)
}
In general, my idea was to show ViewController 1's asset picker, where the user already sees the assets they already selected and can add/remove(deselect) assets. Then transfer the entire asset back to View Controller 2. I'm getting the following message (the app doesn't crash, but its not working either)
2017-09-23 12:51:36.222772+0300 Shippers[1918:547143] Warning: Attempt to present <AssetsPickerViewController.AssetsPickerViewController: 0x14491fe00> on <AppName.PostVC: 0x143e70970> whose view is not in the window hierarchy!
2017-09-23 12:51:36.226 💙AssetsPhotoViewController.updateEmptyView:257 - emptyView.isHidden: false, count: 0
2017-09-23 12:51:36.227 💙AssetsPhotoViewController.updateNoPermissionView:262 - isHidden: true
2017-09-23 12:51:36.227 💙AssetsPhotoViewController.updateNoPermissionView:262 - isHidden: true
2017-09-23 12:51:36.339 💙AssetsManager.fetchAlbums:507 - Default album is "Camera Roll"
2017-09-23 12:51:36.360 💙AssetsManager.fetchAlbums:507 - Default album is "Camera Roll"
2017-09-23 12:51:36.421 💙AssetsPhotoViewController.updateEmptyView:257 - emptyView.isHidden: true, count: 1591
I assume I'm doing it all wrong. But I'm really not sure how to accomplish that. Also, is there a way to set a limit to the max amount of selected items? I.e. 10 photos max?
Really like the assets picker, thanks!
Would it be possible to configure the checkmark colour by adding a UIColor
property to the AssetsPickerConfig
, that would replace the checkmarkBlue2
that is currently hardcoded? Our app uses a specific colour theme and the default blue doesn't work for us.
func drawRectChecked(rect: CGRect) {
guard let context = UIGraphicsGetCurrentContext() else { return }
let checkmarkBlue2 = UIColor(red: 0.078, green: 0.435, blue: 0.875, alpha: 1)
...
}
Thanks in advance!
Hey,
I have a project on ios 11/swift4.
after pod install im trying to use the AssetPicker.
imported the file, added the delegates but the function gets an error, use of undeclared type PHAsset.
func assetsPicker(controller: AssetsPickerViewController, selected assets: [PHAsset]) {
// do your job with selected assets
}
I clicked on PHAsset and it took me to the below line. Shouldnt it have ios 11 as well?
PHOTOS_CLASS_AVAILABLE_IOS_TVOS(8_0, 10_0) @interface PHAsset : PHObject
I need to sort the images by creationDate Desc, so I added this code
let options = PHFetchOptions() options.sortDescriptors = [ NSSortDescriptor(key: "creationDate", ascending: false) ]
But when I open the assetpicket it scrolls to the bottom and I need to scroll all the way back up to the screen, is there a way to keep the scroll from moving at all?
Thanks!
Is there a way to implement select cell programmatically from the viewcontroller I've instantiated the AssetsPickerViewController into ?
also, is there a way to make it start off on the album selection view, instead of showing a specific albums content on start up ?
-great project, thank you for sharing!
Over the past few weeks, my app has experienced three crashes in AssetsPickerViewController. I'm unable to replicate it myself, and the Fabric Crashlytics traces are not super helpful (or maybe I just don't know how to read them properly), but I pasted some of the traces below (all three look very similar). Looks like something to do with one of the "synchronize" functions in AssetManager?
Also, from looking at Crashlytics, it looks like the crash so far has happened when the user's device has a low amount of free memory available (e.g. 150MB - 80MB available), on iOS 11.1 or 11.2. Not sure if that's helpful.
I am using Swift 3. Any ideas would be greatly appreciated, thank you!
Crashed: PHChange-queue
0 AssetsPickerViewController 0x1003c5d68 _T026AssetsPickerViewController0A7ManagerC011synchronizeA0ySay10Foundation8IndexSetVG012updatedAlbumH4Sets_s10DictionaryVySSSo13PHFetchResultCySo7PHAssetCGG21fetchMapBeforeChangesSo8PHChangeC14changeInstancetFTf4gggn_n + 14136
1 AssetsPickerViewController 0x1003bd3a0 _T026AssetsPickerViewController0A7ManagerC011synchronizeA0ySay10Foundation8IndexSetVG012updatedAlbumH4Sets_s10DictionaryVySSSo13PHFetchResultCySo7PHAssetCGG21fetchMapBeforeChangesSo8PHChangeC14changeInstancetFTo + 176
2 AssetsPickerViewController 0x1003c619c _T026AssetsPickerViewController0A7ManagerC21photoLibraryDidChangeySo8PHChangeCFTf4gn_n + 392
3 AssetsPickerViewController 0x1003bd44c _T026AssetsPickerViewController0A7ManagerC21photoLibraryDidChangeySo8PHChangeCFTo + 40
4 Photos 0x194a7348c __40-[PHPhotoLibrary _processPendingChanges]_block_invoke.656 + 420
5 Photos 0x194a285c4 -[PHChange preloadChangeDetailsForFetchResults:inManagedObjectContext:handler:] + 904
6 Photos 0x194a72fe4 -[PHPhotoLibrary _processPendingChanges] + 560
7 AssetsLibraryServices 0x1938da1fc __pl_dispatch_after_block_invoke + 36
8 libdispatch.dylib 0x185d66a14 _dispatch_client_callout + 16
9 libdispatch.dylib 0x185d6ef08 _dispatch_continuation_pop$VARIANT$mp + 428
10 libdispatch.dylib 0x185d78848 _dispatch_source_invoke$VARIANT$mp + 1588
11 libdispatch.dylib 0x185d70824 _dispatch_queue_serial_drain$VARIANT$mp + 200
12 libdispatch.dylib 0x185d712fc _dispatch_queue_invoke$VARIANT$mp + 340
13 libdispatch.dylib 0x185d71d20 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 404
14 libdispatch.dylib 0x185d7a03c _dispatch_workloop_worker_thread$VARIANT$mp + 644
15 libsystem_pthread.dylib 0x18600ef1c _pthread_wqthread + 932
16 libsystem_pthread.dylib 0x18600eb6c start_wqthread + 4
Crashed: PHChange-queue
0 AssetsPickerViewController 0x100b81204 _T026AssetsPickerViewController0A7ManagerC17synchronizeAlbumsSay10Foundation8IndexSetVGSo8PHChangeC14changeInstance_tFTf4gn_n + 3052
1 AssetsPickerViewController 0x100b7cd70 _T026AssetsPickerViewController0A7ManagerC17synchronizeAlbumsSay10Foundation8IndexSetVGSo8PHChangeC14changeInstance_tFTo + 44
2 AssetsPickerViewController 0x100b860e0 _T026AssetsPickerViewController0A7ManagerC21photoLibraryDidChangeySo8PHChangeCFTf4gn_n + 204
3 AssetsPickerViewController 0x100b7d44c _T026AssetsPickerViewController0A7ManagerC21photoLibraryDidChangeySo8PHChangeCFTo + 40
4 Photos 0x19359848c __40-[PHPhotoLibrary _processPendingChanges]_block_invoke.656 + 420
5 Photos 0x19354d5c4 -[PHChange preloadChangeDetailsForFetchResults:inManagedObjectContext:handler:] + 904
6 Photos 0x193597fe4 -[PHPhotoLibrary _processPendingChanges] + 560
7 AssetsLibraryServices 0x1923ff1fc __pl_dispatch_after_block_invoke + 36
8 libdispatch.dylib 0x1847b6a54 _dispatch_call_block_and_release + 24
9 libdispatch.dylib 0x1847b6a14 _dispatch_client_callout + 16
10 libdispatch.dylib 0x1847c096c _dispatch_queue_serial_drain$VARIANT$mp + 528
11 libdispatch.dylib 0x1847c12fc _dispatch_queue_invoke$VARIANT$mp + 340
12 libdispatch.dylib 0x1847c1d20 _dispatch_root_queue_drain_deferred_wlh$VARIANT$mp + 404
13 libdispatch.dylib 0x1847ca03c _dispatch_workloop_worker_thread$VARIANT$mp + 644
14 libsystem_pthread.dylib 0x184a5ef1c _pthread_wqthread + 932
15 libsystem_pthread.dylib 0x184a5eb6c start_wqthread + 4
how i can set only single photo selection? and only photo multiply selection
thx
I currently have a scenario where we want the user to proceed only if a specific amount of assets are selected.
Currently, is there a way to perform this check, then subsequently decide whether the image picker should dismiss?
As far as my testing is concerned, all the exposed methods cannot stop a default dismissal via pressing done?
All of the AssetsPickerViewControllerDelegate delegate methods are required, even though most of them are not necessary in a lot of cases (ex: shouldSelect, didSelect, etc). I'm required to implement functions that I don't have any need to implement, making my view controller unnecessarily bloated.
I have this need of selection like 50 consecutive images (but not all) or so at the same time, so instead of selecting one by one is there a way to swipe the range of images just like in the "Photos App", when you hit the select button at the top it lets you just swipe once and start your selection
Thanks!
Hi @mikemike396 and @JoseSanchezMirandaRos @DragonCherry
I am fetching multiple video assets from PHAssets.But i need AVAssetsurl form PHAssets ,some time i am getting nil . Pls tell me any solution for this.
I am using below code
self.getURL(ofPhotoWith: self.assets[i], completionHandler: { Result in
print("NEW_VIDEO_AVURL\(Result)")
})
func getURL(ofPhotoWith mPhasset: PHAsset, completionHandler : @escaping ((_ responseURL : URL?) -> Void)) {
if mPhasset.mediaType == .image {
let options: PHContentEditingInputRequestOptions = PHContentEditingInputRequestOptions()
options.canHandleAdjustmentData = {(adjustmeta: PHAdjustmentData) -> Bool in
return true
}
mPhasset.requestContentEditingInput(with: options, completionHandler: { (contentEditingInput, info) in
completionHandler(contentEditingInput!.fullSizeImageURL)
})
} else if mPhasset.mediaType == .video {
let options = PHVideoRequestOptions()
options.version = .original
options.deliveryMode = .highQualityFormat
options.isNetworkAccessAllowed = true
PHImageManager.default().requestAVAsset(forVideo: mPhasset, options: options, resultHandler: { (asset, audioMix, info) in
if let urlAsset = asset as? AVURLAsset {
let localVideoUrl = urlAsset.url
completionHandler(localVideoUrl)
} else {
completionHandler(nil)
}
})
}
}
Thanks&Regards
Ramohan Reddy
Hi, I'm hoping to try your picker control, however I'm running into an install problem. When trying to setup the control per the documentation
let picker = AssetsPickerViewController()
I get a "Use of unresolved identifier 'AssetsPickerViewController' build error.
I've added the pod directive to the Podfile and executed 'pod install' which appears to have completed successfully.
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'iOSTest' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for iOSTest
pod 'AWSCore', '~> 2.9.0'
pod 'AWSS3', '~> 2.9.0'
pod 'AWSMobileClient', '~> 2.9.0'
pod 'AWSAuthUI', '~> 2.9.0'
pod 'AWSUserPoolsSignIn', '~> 2.9.0'
pod 'AssetsPickerViewController', '~>2.0'
end
I can see the AssetsPickerViewController folder under the Pods folder in my project directory and the Podfile.lock appears so show AssestsPickerViewController references as expected.
PODS:
- AssetsPickerViewController (2.5.7):
- Device
- Dimmer
- FadeView
- SnapKit
- SwiftARGB
- TinyLog
- AWSAuthCore (2.9.8):
- AWSCore (= 2.9.8)
- AWSAuthUI (2.9.8):
- AWSAuthCore (= 2.9.8)
- AWSCore (= 2.9.8)
- AWSCognitoIdentityProvider (2.9.8):
- AWSCognitoIdentityProviderASF (= 1.0.1)
- AWSCore (= 2.9.8)
- AWSCognitoIdentityProviderASF (1.0.1)
- AWSCore (2.9.8)
- AWSMobileClient (2.9.8):
- AWSAuthCore (= 2.9.8)
- AWSCognitoIdentityProvider (= 2.9.8)
- AWSS3 (2.9.8):
- AWSCore (= 2.9.8)
- AWSUserPoolsSignIn (2.9.8):
- AWSAuthCore (= 2.9.8)
- AWSCognitoIdentityProvider (= 2.9.8)
- Device (3.1.2)
- Dimmer (2.2.0):
- FadeView (~> 2.0)
- SnapKit
- UIViewKVO (~> 2.0)
- FadeView (2.0.0)
- SnapKit (4.2.0)
- SwiftARGB (2.0.0)
- TinyLog (2.0.7)
- UIViewKVO (2.0.0)
DEPENDENCIES:
- AssetsPickerViewController (~> 2.0)
- AWSAuthUI (~> 2.9.0)
- AWSCore (~> 2.9.0)
- AWSMobileClient (~> 2.9.0)
- AWSS3 (~> 2.9.0)
- AWSUserPoolsSignIn (~> 2.9.0)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- AssetsPickerViewController
- AWSAuthCore
- AWSAuthUI
- AWSCognitoIdentityProvider
- AWSCognitoIdentityProviderASF
- AWSCore
- AWSMobileClient
- AWSS3
- AWSUserPoolsSignIn
- Device
- Dimmer
- FadeView
- SnapKit
- SwiftARGB
- TinyLog
- UIViewKVO
SPEC CHECKSUMS:
AssetsPickerViewController: 93142e1f104320c82985ad09b28b877ecd97e883
AWSAuthCore: 7ebbe523f28149a1706e7ec1736203cdaaeba380
AWSAuthUI: 0f3c2c19606776ba990136ca2d2e81518eb08afe
AWSCognitoIdentityProvider: 738b488930eca71cbaa91ac53764b146e90a6650
AWSCognitoIdentityProviderASF: f94f1a502e72ef3d0a1de93e10bf7a79c8698118
AWSCore: 5da86c5afde44a87b06a2df50601bca81a8cee13
AWSMobileClient: d3b6cbe30dcdb45866c85b0d088106504f72d4a3
AWSS3: a5e12eb2495bbe49cda8b0595fa77280aacd7d3d
AWSUserPoolsSignIn: 127aebb7fd668b4e897063c34356f9e25a576b84
Device: 62242076214c30fb5760174b3601cefafa70a481
Dimmer: 55721e2f218f965474b8319d4457ed76e5e59ef0
FadeView: 80197da2fbee5382b178127e8c5f988a35eef018
SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a
SwiftARGB: 8727cfcdcfe8709e707a2391f1d5802a7c40dcad
TinyLog: 073a9abfd44a944886d5d07aa49cbba5ef192335
UIViewKVO: 091f9e020d69e73c4bf5e5ef61cde7bff1c24bbf
PODFILE CHECKSUM: 4f3bcdffb036ea616b29788057758ec4b4ab699a
COCOAPODS: 1.7.1
I've tried doing a clean and rebuild, etc. but to no avail.
I'm hoping I'm missing something really simple that you might be able to point me to...
Thanks,
Shaun
`
@IBAction func addImageBtnAct(_ sender: Any) {
if (sender as AnyObject).tag == 0
{
picker.accessibilityHint = "image"
pickerconfig.selectedAssets = imageAssets
}
else {
picker.accessibilityHint = "menuImage"
pickerconfig.selectedAssets = menuImageAssets
}
present(picker, animated: true, completion: nil)
///this is the button action
func assetsPicker(controller: AssetsPickerViewController, selected assets: [PHAsset]) {
// do your job with selected assets
if controller.accessibilityHint == "image" {
self.imageAssets = assets
imagesCollectionView.reloadData()
}else if controller.accessibilityHint == "menuImage" {
self.menuImageAssets = assets
self.menuImagesCollectionView.reloadData()
}
}
`
please help me to do this
When tapping on the Done or Cancel buttons in AssetsPhotoViewController, the pressedTitle: gesture is recognized. This makes it impossible to dismiss the photos picker, and you just keep bouncing between the Photos and Albums picker views.
I've tried both v1 and v2 repos, linked against iOS 10.3 and 11. Xcode 9.0b2.
I found critical bug in your AssetsPickerViewController.
I trid to take a photo from album in iOS 9.0 using this libary, but app is crashed when I tap the “Cancel" button in the navigation bar by your library.
I have attached the screenshots.
Please check it and hope to be fixed asap.
Regards
Getting crashes on multiple devices and iOS 10 and 11. Any idea?
# Date: 2017-10-02T13:03:00Z
# OS Version: 10.2.1 (14D27)
# Device: iPhone 6
# RAM Free: 2%
# Disk Free: 1.4%
#22. Crashed: PHChange-queue
0 AssetsPickerViewController 0x1007bb314 specialized AssetsManager.synchronizeAssets(updatedAlbumIndexSets : [IndexSet], fetchMapBeforeChanges : [String : PHFetchResult<PHAsset>], changeInstance : PHChange) -> () (AssetsManager+Sync.swift:189)
1 AssetsPickerViewController 0x1007b3d18 @objc AssetsManager.synchronizeAssets(updatedAlbumIndexSets : [IndexSet], fetchMapBeforeChanges : [String : PHFetchResult<PHAsset>], changeInstance : PHChange) -> () (AssetsManager+Sync.swift)
2 AssetsPickerViewController 0x1007bb5f4 specialized AssetsManager.photoLibraryDidChange(PHChange) -> () (AssetsManager+Sync.swift:202)
3 AssetsPickerViewController 0x1007b3dc4 @objc AssetsManager.photoLibraryDidChange(PHChange) -> () (AssetsManager+Sync.swift)
4 Photos 0x194f8bfdc __40-[PHPhotoLibrary _processPendingChanges]_block_invoke.617 + 432
5 Photos 0x194f45d24 -[PHChange preloadChangeDetailsForFetchResults:inManagedObjectContext:handler:] + 912
6 Photos 0x194f8bb38 -[PHPhotoLibrary _processPendingChanges] + 568
7 AssetsLibraryServices 0x193ced0e8 __pl_dispatch_after_block_invoke + 36
8 libdispatch.dylib 0x1884121fc _dispatch_call_block_and_release + 24
9 libdispatch.dylib 0x1884121bc _dispatch_client_callout + 16
10 libdispatch.dylib 0x1884203dc _dispatch_queue_serial_drain + 928
11 libdispatch.dylib 0x1884159a4 _dispatch_queue_invoke + 652
12 libdispatch.dylib 0x18842234c _dispatch_root_queue_drain + 572
13 libdispatch.dylib 0x1884220ac _dispatch_worker_thread3 + 124
14 libsystem_pthread.dylib 0x18861b2a0 _pthread_wqthread + 1288
15 libsystem_pthread.dylib 0x18861ad8c start_wqthread + 4
--
#0. com.apple.main-thread
0 libsystem_platform.dylib 0x1886183a4 os_unfair_lock_lock + 8
1 QuartzCore 0x18c8e4ad4 CA::Layer::add_animation(CAAnimation*, __CFString const*) + 76
2 QuartzCore 0x18c8e49f0 -[CALayer addAnimation:forKey:] + 500
3 UIKit 0x18f4756bc -[UIViewAnimationState pop] + 812
4 UIKit 0x18f475190 +[UIViewAnimationState popAnimationState] + 64
5 UIKit 0x18f4741e4 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 880
6 UIKit 0x18f73c900 +[UIView(UIViewAnimationWithBlocks) transitionWithView:duration:options:animations:completion:] + 124
7 AssetsPickerViewController 0x1007de9b4 specialized AssetsPhotoViewController.(collectionView(UICollectionView, willDisplay : UICollectionViewCell, forItemAt : IndexPath) -> ()).(closure #1) (AssetsPhotoViewController.swift:521)
8 AssetsPickerViewController 0x1007d655c AssetsPhotoViewController.(collectionView(UICollectionView, willDisplay : UICollectionViewCell, forItemAt : IndexPath) -> ()).(closure #1) (AssetsPhotoViewController.swift)
9 AssetsPickerViewController 0x1007c63c8 partial apply for thunk (AssetsManager.swift)
10 libdispatch.dylib 0x1884121fc _dispatch_call_block_and_release + 24
11 libdispatch.dylib 0x1884121bc _dispatch_client_callout + 16
12 libdispatch.dylib 0x188416d68 _dispatch_main_queue_callback_4CF + 1000
13 CoreFoundation 0x189536810 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
14 CoreFoundation 0x1895343fc __CFRunLoopRun + 1660
15 CoreFoundation 0x1894622b8 CFRunLoopRunSpecific + 444
16 GraphicsServices 0x18af16198 GSEventRunModal + 180
17 UIKit 0x18f4a97fc -[UIApplication _run] + 684
18 UIKit 0x18f4a4534 UIApplicationMain + 208
19 Smart Post 0x1000ef24c main (main.m:16)
20 libdispatch.dylib 0x1884455b8 (Missing)
#1. com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x188539188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x188538ff8 mach_msg + 72
2 CoreFoundation 0x1895365d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x1895341ec __CFRunLoopRun + 1132
4 CoreFoundation 0x1894622b8 CFRunLoopRunSpecific + 444
5 Foundation 0x189f9f26c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6 Foundation 0x189fbfdd0 -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7 UIKit 0x18fe1dc38 -[UIEventFetcher threadMain] + 136
8 Foundation 0x18a09ce68 __NSThread__start__ + 1024
9 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
10 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
11 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
#2. Thread
0 libsystem_kernel.dylib 0x188556e1c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x18861c9c0 _pthread_cond_wait + 640
2 libc++.1.dylib 0x187f453ec std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 56
3 JavaScriptCore 0x18dd665d0 void std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::unique_lock<bmalloc::Mutex>&) + 112
4 JavaScriptCore 0x18dd66544 bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::threadRunLoop() + 168
5 JavaScriptCore 0x18dd66424 std::__1::__shared_ptr_emplace<std::__1::mutex, std::__1::allocator<std::__1::mutex> >::~__shared_ptr_emplace() + 10
6 JavaScriptCore 0x18dd666d4 void* std::__1::__thread_proxy<std::__1::tuple<void (*)(bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*), bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*> >(void*) + 92
7 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
8 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
9 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
#3. WebThread
0 libsystem_kernel.dylib 0x188539188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x188538ff8 mach_msg + 72
2 CoreFoundation 0x1895365d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x1895341ec __CFRunLoopRun + 1132
4 CoreFoundation 0x1894622b8 CFRunLoopRunSpecific + 444
5 WebCore 0x18e068490 RunWebThread(void*) + 456
6 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
7 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
8 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
#4. GAIThread
0 libsystem_kernel.dylib 0x188539188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x188538ff8 mach_msg + 72
2 CoreFoundation 0x1895365d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x1895341ec __CFRunLoopRun + 1132
4 CoreFoundation 0x1894622b8 CFRunLoopRunSpecific + 444
5 Foundation 0x189f9f26c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6 Foundation 0x189ff3aa0 -[NSRunLoop(NSRunLoop) run] + 88
7 Smart Post 0x100114ab0 +[GAI threadMain:] (GAI.m:241)
8 Foundation 0x18a09ce68 __NSThread__start__ + 1024
9 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
10 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
11 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
#5. com.twitter.crashlytics.ios.MachExceptionServer
0 Smart Post 0x100149474 CLSProcessRecordAllThreads (CLSProcess.c:376)
1 Smart Post 0x100149474 CLSProcessRecordAllThreads (CLSProcess.c:376)
2 Smart Post 0x100149324 CLSProcessRecordAllThreads (CLSProcess.c:407)
3 Smart Post 0x10013959c CLSHandler (CLSHandler.m:26)
4 Smart Post 0x1001345b8 CLSMachExceptionServer (CLSMachException.c:446)
5 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
6 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
7 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
#6. com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x188539188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x188538ff8 mach_msg + 72
2 CoreFoundation 0x1895365d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x1895341ec __CFRunLoopRun + 1132
4 CoreFoundation 0x1894622b8 CFRunLoopRunSpecific + 444
5 CFNetwork 0x189c67a70 +[NSURLConnection(Loader) _resourceLoadLoop:] + 336
6 Foundation 0x18a09ce68 __NSThread__start__ + 1024
7 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
8 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
9 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
#7. PLClientLoggingAdaptivePermissionWorkQueue
0 libsystem_kernel.dylib 0x188539188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x188538ff8 mach_msg + 72
2 libdispatch.dylib 0x188428868 _dispatch_mach_send_and_wait_for_reply + 516
3 libdispatch.dylib 0x188428cb0 dispatch_mach_send_with_result_and_wait_for_reply + 60
4 libxpc.dylib 0x18865cf90 xpc_connection_send_message_with_reply_sync + 196
5 PowerLog 0x18b7d6878 -[PLClientLogger xpcSendMessageWithReply:withClientID:withKey:withPayload:] + 232
6 PowerLog 0x18b7d6d74 __57-[PLClientLogger permissionForClientID:withKey:withType:]_block_invoke + 140
7 libdispatch.dylib 0x1884121fc _dispatch_call_block_and_release + 24
8 libdispatch.dylib 0x1884121bc _dispatch_client_callout + 16
9 libdispatch.dylib 0x1884203dc _dispatch_queue_serial_drain + 928
10 libdispatch.dylib 0x1884159a4 _dispatch_queue_invoke + 652
11 libdispatch.dylib 0x1884208d8 _dispatch_queue_override_invoke + 360
12 libdispatch.dylib 0x18842234c _dispatch_root_queue_drain + 572
13 libdispatch.dylib 0x1884220ac _dispatch_worker_thread3 + 124
14 libsystem_pthread.dylib 0x18861b2a0 _pthread_wqthread + 1288
15 libsystem_pthread.dylib 0x18861ad8c start_wqthread + 4
#8. JIT Worklist Worker Thread
0 libsystem_kernel.dylib 0x188556e1c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x18861c9c0 _pthread_cond_wait + 640
2 libc++.1.dylib 0x187f453ec std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 56
3 JavaScriptCore 0x18dd4ed64 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) + 2132
4 JavaScriptCore 0x18db26a5c JSC::JITWorklist::runThread() + 192
5 JavaScriptCore 0x18db26eac WTF::Vector<WTF::RefPtr<JSC::JITWorklist::Plan>, 32ul, WTF::CrashOnOverflow, 16ul>::expandCapacity(unsigned long, WTF::RefPtr<JSC::JITWorklist::Plan>*) + 14
6 JavaScriptCore 0x18d49700c WTF::threadEntryPoint(void*) + 212
7 JavaScriptCore 0x18d496f1c WTF::wtfThreadEntryPoint(void*) + 24
8 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
9 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
10 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
#9. WTF Parallel Helper Thread
0 libsystem_kernel.dylib 0x188556e1c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x18861c9c0 _pthread_cond_wait + 640
2 libc++.1.dylib 0x187f453ec std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 56
3 JavaScriptCore 0x18dd4ed64 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) + 2132
4 JavaScriptCore 0x18dd4e2e8 WTF::ParallelHelperPool::waitForClientWithTask(WTF::Locker<WTF::LockBase> const&) + 288
5 JavaScriptCore 0x18dd4e088 WTF::ParallelHelperPool::helperThreadBody() + 76
6 JavaScriptCore 0x18d49700c WTF::threadEntryPoint(void*) + 212
7 JavaScriptCore 0x18d496f1c WTF::wtfThreadEntryPoint(void*) + 24
8 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
9 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
10 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
#10. AVAudioSession Notify Thread
0 libsystem_kernel.dylib 0x188539188 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x188538ff8 mach_msg + 72
2 CoreFoundation 0x1895365d0 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x1895341ec __CFRunLoopRun + 1132
4 CoreFoundation 0x1894622b8 CFRunLoopRunSpecific + 444
5 AVFAudio 0x1a3103d24 GenericRunLoopThread::Entry(void*) + 164
6 AVFAudio 0x1a3129d9c CAPThread::Entry(CAPThread*) + 84
7 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
8 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
9 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
#11. WebCore: LocalStorage
0 libsystem_kernel.dylib 0x188556e1c __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x18861c9c0 _pthread_cond_wait + 640
2 libc++.1.dylib 0x187f453ec std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 56
3 JavaScriptCore 0x18dd4ed64 WTF::ParkingLot::parkConditionallyImpl(void const*, WTF::ScopedLambda<bool ()> const&, WTF::ScopedLambda<void ()> const&, std::__1::chrono::time_point<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >) + 2132
4 WebKitLegacy 0x18f14ee00 bool WTF::ConditionBase::waitForSecondsImpl<WTF::Lock>(WTF::Lock&, double) + 128
5 WebKitLegacy 0x18f14ec18 std::__1::unique_ptr<WTF::Function<void ()>, std::__1::default_delete<WTF::Function<void ()> > > WTF::MessageQueue<WTF::Function<void ()> >::waitForMessageFilteredWithTimeout<WTF::MessageQueue<WTF::Function<void ()> >::waitForMessage()::'lambda'(WTF::Function<void ()> const&)>(WTF::MessageQueueWaitResult&, WTF::MessageQueue<WTF::Function<void ()> >::waitForMessage()::'lambda'(WTF::Function<void ()> const&)&&, double) + 124
6 WebKitLegacy 0x18f14e240 WebCore::StorageThread::threadEntryPoint() + 68
7 JavaScriptCore 0x18d49700c WTF::threadEntryPoint(void*) + 212
8 JavaScriptCore 0x18d496f1c WTF::wtfThreadEntryPoint(void*) + 24
9 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
10 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
11 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
#12. com.apple.photos.imgmgr.cplfireandforget
0 libsystem_kernel.dylib 0x1885391c4 semaphore_wait_trap + 8
1 libdispatch.dylib 0x1884247d8 _dispatch_semaphore_wait_slow + 216
2 Photos 0x194f5a63c __66-[PHCoreImageManager _fireAndForgetCPLDownloadWithRequest:format:]_block_invoke_2 + 180
3 libdispatch.dylib 0x1884121bc _dispatch_client_callout + 16
4 libdispatch.dylib 0x18841dab0 _dispatch_block_invoke_direct + 376
5 AssetsLibraryServices 0x193cecddc __pl_dispatch_async_block_invoke + 36
6 libdispatch.dylib 0x1884121fc _dispatch_call_block_and_release + 24
7 libdispatch.dylib 0x1884121bc _dispatch_client_callout + 16
8 libdispatch.dylib 0x1884203dc _dispatch_queue_serial_drain + 928
9 libdispatch.dylib 0x1884159a4 _dispatch_queue_invoke + 652
10 libdispatch.dylib 0x18842234c _dispatch_root_queue_drain + 572
11 libdispatch.dylib 0x1884220ac _dispatch_worker_thread3 + 124
12 libsystem_pthread.dylib 0x18861b2a0 _pthread_wqthread + 1288
13 libsystem_pthread.dylib 0x18861ad8c start_wqthread + 4
#13. Thread
0 libsystem_pthread.dylib 0x18861ad88 start_wqthread + 126
#14. Thread
0 libsystem_pthread.dylib 0x18861ad88 start_wqthread + 126
#15. Thread
0 libsystem_kernel.dylib 0x188557a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x18861b344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x18861ad8c start_wqthread + 4
#16. Thread
0 libsystem_kernel.dylib 0x188557a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x18861b344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x18861ad8c start_wqthread + 4
#17. Thread
0 libsystem_kernel.dylib 0x188557a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x18861b344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x18861ad8c start_wqthread + 4
#18. Thread
0 libsystem_kernel.dylib 0x188557a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x18861b344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x18861ad8c start_wqthread + 4
#19. Thread
0 libsystem_kernel.dylib 0x188557a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x18861b344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x18861ad8c start_wqthread + 4
#20. Thread
0 libsystem_pthread.dylib 0x18861ad88 start_wqthread + 126
#21. Thread
0 libsystem_kernel.dylib 0x188557a88 __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x18861b344 _pthread_wqthread + 1452
2 libsystem_pthread.dylib 0x18861ad8c start_wqthread + 4
#22. Crashed: PHChange-queue
0 AssetsPickerViewController 0x1007bb314 specialized AssetsManager.synchronizeAssets(updatedAlbumIndexSets : [IndexSet], fetchMapBeforeChanges : [String : PHFetchResult<PHAsset>], changeInstance : PHChange) -> () (AssetsManager+Sync.swift:189)
1 AssetsPickerViewController 0x1007b3d18 @objc AssetsManager.synchronizeAssets(updatedAlbumIndexSets : [IndexSet], fetchMapBeforeChanges : [String : PHFetchResult<PHAsset>], changeInstance : PHChange) -> () (AssetsManager+Sync.swift)
2 AssetsPickerViewController 0x1007bb5f4 specialized AssetsManager.photoLibraryDidChange(PHChange) -> () (AssetsManager+Sync.swift:202)
3 AssetsPickerViewController 0x1007b3dc4 @objc AssetsManager.photoLibraryDidChange(PHChange) -> () (AssetsManager+Sync.swift)
4 Photos 0x194f8bfdc __40-[PHPhotoLibrary _processPendingChanges]_block_invoke.617 + 432
5 Photos 0x194f45d24 -[PHChange preloadChangeDetailsForFetchResults:inManagedObjectContext:handler:] + 912
6 Photos 0x194f8bb38 -[PHPhotoLibrary _processPendingChanges] + 568
7 AssetsLibraryServices 0x193ced0e8 __pl_dispatch_after_block_invoke + 36
8 libdispatch.dylib 0x1884121fc _dispatch_call_block_and_release + 24
9 libdispatch.dylib 0x1884121bc _dispatch_client_callout + 16
10 libdispatch.dylib 0x1884203dc _dispatch_queue_serial_drain + 928
11 libdispatch.dylib 0x1884159a4 _dispatch_queue_invoke + 652
12 libdispatch.dylib 0x18842234c _dispatch_root_queue_drain + 572
13 libdispatch.dylib 0x1884220ac _dispatch_worker_thread3 + 124
14 libsystem_pthread.dylib 0x18861b2a0 _pthread_wqthread + 1288
15 libsystem_pthread.dylib 0x18861ad8c start_wqthread + 4
#23. Thread
0 libsystem_kernel.dylib 0x1885391dc semaphore_timedwait_trap + 8
1 libdispatch.dylib 0x188424770 _dispatch_semaphore_wait_slow + 112
2 libdispatch.dylib 0x188423808 _dispatch_worker_thread + 268
3 libsystem_pthread.dylib 0x18861d850 _pthread_body + 240
4 libsystem_pthread.dylib 0x18861d760 _pthread_body + 282
5 libsystem_pthread.dylib 0x18861ad94 thread_start + 4
When I run AssetsPickerViewController in Dark Mode, the background is white and everything looks not good. Please update it for dark mode. Thanks.
App will crash immediately when scrolling extremely fast on photo picker controller. I only experience this on real device.
I'm currently running it on iPhone 6s using iOS 13.0 GM. I also came across with the same issue on 13.0 beta8 and 13.1 beta3. Not sure if it applies to iOS 12.
AssetsPhotoViewController.swift
By the way thank you for this amazing assets picker! I really enjoy this iOS native style UI. Keep working!! 💪
Thanks!
I am using navigation of view controller from view controller I am presenting the AssetsPickerViewController after presenting the navigation bar items i.e cancel , done titles is not showing. can you please . check and update.
Installing with coca pods in Xcode 10.1 is giving the error: No such module 'PureLayout'
I presented the VC in landscape mode, and not the buttons works. Instead pressedTitle
got called every time.
Any idea when you'll have Swift 5.0 support?
Any chance you can add Carthage support? There are more people like me that do not want or cannot use Cocoapods.
I added Carthage support in my fork, but it broke Cocoapods (no real experience with it) and I had to "embed" all the small pods you use in this repo, so keeping everything up to date is a bit of a hassle.
Hello! Firstly, thank you so much for creating AssetsPickerViewController and sharing it with the world. I'm a huge fan of any custom UI that closely mimics Apple's default UI, because it makes life easier for end users. You've done a really nice job here.
I've been digging around in the code a little and spotted this comment and configuration option:
/// Not yet fully implemeted, do not set this true until it's completed.
open var albumIsShowMomentAlbums: Bool = false
If I'm reading things correctly, it looks like you're considering providing the ability to include the Moments album for choosing multiple photos too. I would love to make use of this feature if it was available. Are you still planning on including it? If so, do you have any idea when you might tackle it?
Many thanks!
Megan
I'm having problem with didSelectItemAt
in a UICollectionViewCell
. I'm using the framework to select multiple photos from the photo library. The selected assets are then transferred and stored in a array of PHAssets
. I use a small script for custom preview of the images when tapped on them. (It basically expands the image to full screen and put in and then you can swipe up or down to dismiss it). The problem is not with the images, they're properly displayed in my custom UICollectionViewCell
. The problem is when I tap on them. For some reason it gives the wrong image as a preview and I have no idea why it's not taking the corresponding image. What am I doing wrong? This is my code:
var cameraPhotoUIImage: UIImage?
var assets = [PHAsset]()
lazy var assetsTurnedIntoImages =
{
return [UIImage]()
}()
lazy var imageManager = {
return PHCachingImageManager()
}()
extension PhotoVC : UICollectionViewDataSource, UICollectionViewDelegate
{
func setupCollectionView()
{
collectionView.dataSource = self
collectionView.delegate = self
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell
{
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "PhotoPostCVCell", for: indexPath) as! PhotoPostCVCell
if let takenImage = cameraPhotoUIImage
{
cell.cellImage.image = takenImage
}
if assets.count > 0
{
let asset = assets[indexPath.row]
imageManager.requestImage(for: asset, targetSize: PHImageManagerMaximumSize, contentMode: .aspectFill, options: nil)
{ (image, info) in
cell.cellImage.contentMode = .scaleAspectFill
cell.cellImage.image = image!
self.assetsTurnedIntoImages.append(image!)
}
}
return cell
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
{
if assets.count > 0
{
return assets.count
}
else
{
return 1
}
}
// MARK: Preview Selected Image
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let postStoryboard = UIStoryboard(name: Storyboard_Post, bundle:nil)
if let destinationVC = postStoryboard.instantiateViewController(withIdentifier: "PreviewImageVC") as? PreviewImageVC
{
destinationVC.allowedDismissDirection = .both
destinationVC.maskType = .clear
if cameraPhotoUIImage != nil
{
destinationVC.transferedImageToPreview.image = cameraPhotoUIImage
destinationVC.showInteractive()
}
if assetsTurnedIntoImages.count > 0
{
print("Selected image to preview:",assetsTurnedIntoImages[indexPath.row] )
destinationVC.transferedImageToPreview.image = assetsTurnedIntoImages[indexPath.row]
destinationVC.showInteractive()
}
}
}
}
My app uses UIStatusBarStyle.lightContent.
However, when UIStatusBarStyle.lightContent is entered, AssetsPickerViewController will not show StatusBar.
So I want to change UIStatusBarStyle to default in AssetsPickerViewController.
Is there a way?
I wonder.
Do you plan to support returning the actual video asset instead of an image of it?
What's coming back when I select a video can be decoded with PHImageManager.default().requestImageData even though it's a file when in reality I need to be able to access it via a PHCachingImageManager().requestAVAsset call and cast to a AVURLAsset .in order to have access to the entire video stream.
I am trying to upload both image and video assets to our server.
File couldn’t be opened because you don’t have permission to view it error. when i am selecting both images and videos, this error is showing that "image.MOV File couldn’t be opened because you don’t have permission to view it error". This error is only for video. Images have no issue.
Dear DragonCherry.
Thanks for your reply.
I have one question.
After I selected the multiple photos and tapped the done.
I can get PHAssets using following delegate method:
And then I am going to show the my custom popup.
But I can't catch the event (dismiss event of AssetsPickerViewController)
Is there any delegate method for it.
Let me know the solutions.
Regards
In my app it is showing iCloud video thumbnails. How can I hide that iCloud video thumbnails?
I have cloned the master branch and after that I have install the pod on that project and project is not working after that please guide me how can I run the example project code.
i think, by default, it sorted by date in the AssetsPickerViewController?
I have some pics which are first in the "all photos" album, they was not taken by my phone. But in my Photos app - those pictures not the firsts. They have order in which they was imported to Photos app...
I am currently trying to use this the most current version of this library in conjunction with Swift 4 and calling this library from Objective C.
Another member I work with opened this issue #17 and solved our perfectly. Thank you.
The issue at hand is from objective c I can see the AssetsPickerViewController class but I cannot access the pickerDelegate to set the property. I believe this will need to be flagged with @objc but I could be wrong. I would have to dig through the source some more and see if I am able to find a solution that works.
So we love the library, its currently in our production app! We have been battling this issue that impacts a few of our users. They claim that on certain images it fails to attach. So we did some digging into our code and found out "getURLWithCompletion:^(NSURL *URL)" URL is returning nil from the "selected" method. I tried to contact these people to find out what type of media it is failing on but cant seem to get any response from anymore. Do you know if there are certain formats (Maybe BMP, TIFF?) that will fail to work with this library? We have never seen any issues on our end using GIFs, PNGs, JPGs, ect). We currently found out that the method is null by logging into a Fabric event when this happens. Any thoughts? Thanks again.
- (void)assetsPickerWithController:(AssetsPickerViewController *)controller selected:(NSArray<PHAsset *> *)assets
{
for (PHAsset *asset in assets)
{
[asset getURLWithCompletion:^(NSURL *URL) {
if (asset.mediaType == PHAssetMediaTypeVideo)
{
[self handleSelectedVideoWithURL:URL];
}
else if (asset.mediaType == PHAssetMediaTypeImage)
{
UIImage *image = [[UIImage imageWithContentsOfFile:URL.path] fixedImage];
[self handleSelectedImage:image withURL:URL.path];
}
}];
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.