Media Library

RSS for tag

Access read-only collections of the user’s multimedia content using Media Library.

Posts under Media Library tag

56 Posts

Post

Replies

Boosts

Views

Activity

Permission string for camera access
Hello everyone, I'm currently in the app soumission process and I struggle to find a valid permission string, specially for the camera access. Could you give me an example of a permission string for camera access that has worked well for you in the app soumission process ? I wish you a good day ! Charles
3
0
2.3k
Aug ’23
MPMediaQuery not returning updated results
I have noticed changes Apple Music made to my library, take in particular a changed album edition that is reflected in how the title is listed. I can see the new title in the Music app in two different devices. On one device MPMediaQuery returns the album with the new title. The other device (an iPad with less memory, in case that matters) is still returning the old edition. Is there anything I can do to make sure the data returned is up to date and matches what is seen in the Music app?
0
0
892
Jul ’23
Extract media information from Apple TV app media (movies and series)
Hi! Is it possible to access metadata information for the personal movie and tv show library? I mean information like the iTunes Store ID, languages, subtitles, has iTunes Extras and maybe even IMDb and TMDB IDs for each title, etc. Is there an API for that like the Apple Music API? I'm no full member of the Apple Developer Program yet, but I'd be very interested if access like with the Apple Music API would also be available for movies and tv shows.
0
0
839
Jun ’23
My Love for the iPhone: An Unmatched Experience.
**Hey everyone, ** I wanted to share my thoughts and experiences with the iPhone. I've been a proud iPhone user for several years now, and I must say, it has been an incredible journey. The iPhone offers a seamless and intuitive user experience like no other. One of the things I love the most about my iPhone is its exceptional build quality. The sleek design and premium materials make it a joy to hold and use. The retina display is breathtaking, offering vibrant colors and sharpness that truly enhance my multimedia experience. But it's not just about the looks. The performance of the iPhone is unparalleled. From blazing-fast app loading times to smooth multitasking, it handles everything with ease. The A-series chips are powerhouses, ensuring lag-free performance even with resource-intensive tasks. Another standout feature is the App Store. With millions of apps to choose from, I can always find the perfect app to suit my needs. Whether it's for productivity, entertainment, or staying connected with loved ones, there's an app for everything. The camera capabilities of the iPhone are nothing short of remarkable. I'm constantly amazed by the stunning photos and videos I can capture with just a few taps. The advanced camera sensors and image processing algorithms make every shot look professional. The ecosystem integration is where the iPhone truly shines. Seamlessly connecting with my MacBook, iPad, and Apple Watch, I can effortlessly switch between devices and continue my tasks without missing a beat. Features like AirDrop, Handoff, and iCloud syncing make my life so much easier. Security and privacy are also top priorities for me, and the iPhone delivers in these aspects as well. The robust security measures, including Face ID or Touch ID, keep my personal data safe and secure. Overall, the iPhone has become an integral part of my daily life. Its combination of stunning design, powerful performance, remarkable camera, ecosystem integration, and top-notch security make it the ultimate smartphone for me. I couldn't be happier with my choice, and I highly recommend it to anyone looking for an unmatched mobile experience. So, fellow iPhone users, what are your favorite features and experiences? Let's share our love for this incredible device! Cheers, James
1
0
1.3k
Jun ’23
MPMediaLibrary.default().addItem broken in macOS 13.4 / Catalyst
The following line of code worked fine in macOS 13.3 / Catalyst: try await MPMediaLibrary.default().addItem(withProductID: "1678639572") Since the 13.4 update it now throws an error: The operation couldn’t be completed. (MPErrorDomain error 11.) Although the Apple Music track with catalog Id 1678639572 does seem to get added to the library regardless. MPError.errorCode 11 is an undocumented value. Can someone please advise what error code 11 actually means, and if there's a workaround? I've raised this as feedback id FB12196635.
0
0
1k
May ’23
Playing apple music from AVFoundation for visualization
Hi I am working on a music app where I can do some sound analysis, my end goal is to integrate Apple Music API in my app where users can search songs. When the song is played I want to show a type of soundwave/spectrogram. For sound visualization I have AVFoundation but the Music API returns only song ID which could be played using Apple MediaPlayer framework only. Is there any API for doing sound analysis or can I play the Apple music songs using AVFoundation.
4
3
2.4k
Apr ’23
[MPMediaLibrary defaultMediaLibrary] addItemWithProductID: freezing in iOS 14.0.1
I use addItemWithProductID: in the code below to add an Apple Music track to the user's library. This is mature code that's worked fine previously. But now in iOS 14.0.1 it causes the app to freeze. I can trace when running from Xcode or the released app version from App Store and the app freezes after the line: NSLog(@"just before addItemWithProductID %@", productID); The ">>>added..." line is never called. Any idea as to how to remedy? (void) addAppleMusicTrackWithProductID: (NSString *) productID {         NSLog(@" addApplemUsic has been called for productID: %@", productID);         SKCloudServiceController *cloudServiceController;         cloudServiceController = [[SKCloudServiceController alloc] init];         [cloudServiceController requestCapabilitiesWithCompletionHandler:^(SKCloudServiceCapability capabilities, NSError * _Nullable error){             NSLog(@"capabilities: %lu error:%@", (unsigned long)capabilities, error);             if (capabilities >= SKCloudServiceCapabilityAddToCloudMusicLibrary)             {                 NSLog(@"just before addItemWithProductID %@", productID);                 [[MPMediaLibrary defaultMediaLibrary] addItemWithProductID:productID completionHandler:^(NSArray<__kindof MPMediaEntity *> * _Nonnull entities, NSError * _Nullable error) {                     NSLog(@">>>added %@ with %i entities: %@ and  error %@",productID, (int) entities.count, entities, error);                     NSArray *tracksToPlay = [NSArray arrayWithObject:productID];                     [musicPlayer setQueueWithStoreIDs:tracksToPlay];                     [musicPlayer play];                     NSLog(@">>>>now playing AM title:%@ | artist:%@", musicPlayer.nowPlayingItem.title, musicPlayer.nowPlayingItem.artist);                                      }];             }         }]; }
8
0
3.1k
Apr ’23
Error returned from daemon: Error Domain=com.apple.accounts Code=7
Hey All, i am getting this error, when i try to pic a picture from library and camera with the help of UIImagePickerController. Anyone have any solution for this? **2022-11-22 12:17:56.241155+0530 ---[10745:2313612] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)"" 2022-11-22 12:17:56.245411+0530 ---[10745:2313614] [PAAccessLogger] Failed to log access with error: access=<PATCCAccess 0x281540780> accessor:<<PAApplication 0x2815403c0 identifierType:auditToken identifier:{pid:10745, version:30182}>> identifier:---kind:intervalEvent timestampAdjustment:0 visibilityState:0 assetIdentifierCount:0 tccService:kTCCServicePhotos, error=Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 7261 named com.apple.privacyaccountingd" UserInfo={NSDebugDescription=connection to service with pid 7261 named com.apple.privacyaccountingd}**
2
3
2.7k
Nov ’22
Digital Signature Drivers Missing Big Sur
Hi all. IM need help with Big Sur Beta 4, because in betas 1 and 2 the drivers pack from third party like epass2003 Feitian Technology works nice and recognize until update for Beta 4. Is that possible copy or replace some files in system like /usr folder to recognize again this midia? If there a way, please im need help. Im not advanced user. Im think is Java problems and missing dylib files on Big Sur beta 4.
12
0
7.5k
Oct ’22
Weird error trying to add Apple Music item to library on iPadOS 16.1
I don't know if this is related to the OS version (iPadOS 16.1) but this used to work for me before on this particular device. I'm doing this: try await MPMediaLibrary.default().addItem(withProductID: catalogId) where catalogId is a valid ID I got from MusicKit. This throws the following error: Error Domain=MPErrorDomain Code=0 "An unknown error occurred." UserInfo={NSLocalizedDescription=An unknown error occurred., NSUnderlyingError=0x2814a1b60 {Error Domain=ICCloudClientErrorDomain Code=2003 "Attempting to retrieve handler for an unsupported configuration" UserInfo={NSLocalizedFailureReason=An ICCloudClient (or HSCloudClient) instance is using a signed-out user identity., NSLocalizedRecoverySuggestion=Listen to ICActiveUserIdentityDidChangeNotification and either update ICCloudClient with the new active account or recreate it, NSLocalizedDescription=Attempting to retrieve handler for an unsupported configuration}}} Not a single Google result for that. The same code on an iPhone with iOS 16.0 works just fine. I tried observing for Notification.Name("ICActiveUserIdentityDidChangeNotification") but that doesn't seem to be fired.
2
0
2.2k
Sep ’22
xcrun simctl addmedia not working after deleting media
I have deleted the folder : rm -rf ~/Library/Developer/CoreSimulator/Devices/<sim udid>/data/Media/** It deleted the files and I am not able to see in Photos app. But when I try to add media file again with command, I got error: xcrun simctl addmedia <sim udid> abc.png Failed to import 'abc.png', error [PHPhotosErrorDomain] -1: The operation couldn’t be completed. (PHPhotosErrorDomain error -1.) An error was encountered processing the command (domain=com.apple.CoreSimulator.LaunchdSimError, code=133): Multiple errors were returned; see stderr Note: If I do not delete the media then addmedia command working as expected, But I have a scenario where I need to clean all photos then add one file. Simulator version: iOS 15.5 xcrun version: 61
2
0
1.5k
Sep ’22
iOS 15.1 Crash: MPMediaLibrary.authorizationStatus
I’d appreciate some help in diagnosing a crash in MPMediaLibrary that occurs on some iOS 15.1.x user devices. So far this issue can't be reproduced with test devices that range from iOS10 to iOS15.2, whether via Xcode 12.4 or TestFlight. The app needs access to the device’s microphone and audio files which are selected via the MPMediaPickerController. The usual usage description keys (namely NSMicrophoneUsageDescription, NSAppleMusicUsageDescription and kTCCServiceMediaLibrary) are specified in the info.plist. The crash relates to library access and involves the iTunesCloud binary. The crash occurs when the app starts, probably for the first time after installation (not the best way to greet new users). Here is a sample crash report: iOS15_1_Crash_MPMediaLibrary_authorizationStatus_anon.txt Here is a typical traceback: Thread 0 Crashed: 0  libsystem_kernel.dylib           0x00000001b8964504 mach_msg_trap + 8 1  libsystem_kernel.dylib           0x00000001b8964b9c mach_msg + 76 (mach_msg.c:119) 2  libdispatch.dylib                0x000000018165227c _dispatch_mach_send_and_wait_for_reply + 520 (mach.c:815) 3  libdispatch.dylib                0x000000018165262c dispatch_mach_send_with_result_and_wait_for_reply + 56 (mach.c:2019) 4  libxpc.dylib                     0x00000001f2576b9c xpc_connection_send_message_with_reply_sync + 240 (connection.c:974) 5  TCC                              0x00000001e961c0c0 tccd_send_message + 940 (TCC.c:490) 6  TCC                              0x00000001e9621e08 __TCCAccessRequest_block_invoke.213 + 876 (TCC.c:591) 7  libdispatch.dylib                0x0000000181637660 _dispatch_client_callout + 20 (object.m:560) 8  libdispatch.dylib                0x00000001816468b4 _dispatch_lane_barrier_sync_invoke_and_complete + 56 (queue.c:1016) 9  libsystem_trace.dylib            0x000000019c147668 _os_activity_initiate_impl + 64 (activity.c:131) 10 TCC                              0x00000001e961d4e0 TCCAccessRequest + 476 (TCC.c:1019) 11 TCC                              0x00000001e961c73c TCCAccessPreflight + 300 (TCC.c:1651) 12 iTunesCloud                      0x0000000198d58160 -[ICCloudServiceStatusMonitor authorizationStatusForScopes:] + 60 (ICCloudServiceStatusMonitor.m:689) 13 MediaPlayer                      0x000000018a8c8ee4 +[MPMediaLibrary authorizationStatus] + 64 (MPMediaLibrary.m:778) 16 MyAppppp                         0x00000001003e9880 AppDelegate.application(_:willFinishLaunchingWithOptions:) + 32 (AppDelegate.swift:23) 17 MyAppppp                         0x00000001003e9880 @objc AppDelegate.application(_:willFinishLaunchingWithOptions:) + 136 (<compiler-generated>:20) The app startup logic is basically: func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { let audioSession = AVAudioSession.sharedInstance() if audioSession.recordPermission == .undetermined { audioSession.requestRecordPermission { // Permission initialized } } if MPMediaLibrary.authorizationStatus() == .notDetermined // Sometimes crashes in iOS15.1 on user devices { MPMediaLibrary.requestAuthorization { // Permission initialized } } if MPMediaLibrary.authorizationStatus() == .authorized { // The following code sometimes crashes in iOS15.1 on user devices without the enclosing ".authorized” check let predicate = MPMediaPropertyPredicate(value: defaultSongId, forProperty: MPMediaItemPropertyPersistentID) let query = MPMediaQuery() } return true } Questions: What exactly is the iTunesCloud binary doing? Is additional configuration needed? Why does the crash happen only on some iOS 15.1 user devices? Is it too early in the app lifecycle to call MPMediaLibrary.authorizationStatus? Post-crash workaround: Are users able to grant access to the library via the device’s global privacy settings? Thanks!
7
0
3.5k
Aug ’22
MPMusicPlayerControllerNowPlayingItemDidChange unexpected behavior
Hello all, I have currently a music app where I set a track from the playlist to play and queue the next one. So 1 track gets played and we prepare the next one by inserting it in the queue. I'm using MPMusicPlayerControllerNowPlayingItemDidChange API to get notified when a track has changed (aka ended) so that I get to queue the next one. In this way we make sure that we always have the next track ready to play in the queue (also if the user decides to hit next in lock screen). Now, hitting the "next" button on the lock screen will correctly go through the tracks which tells me the queue is working properly. BUT if I just let the tracks finish on their own then this logic isn't working correctly. The problem I'm facing is that now when one of the songs ends the API returns nowPlayingItem one of the previous songs, thus repeating the previous track and breaking the implemented logic. I'm facing this in iOS 15.5 and I know this used to work in the past. I'm not sure at what version it broke but I wanted to see if there's others that are expecting the same behavior and if somebody is looking into this issue.
0
0
1.1k
Aug ’22
requestContentEditingInput fullSizeImageURL is empty
I try to get fullSizeImageURL and then calculate md5 of asset via url: var assetUrl = syncUrl(asset: asset) let assetMD5 = md5File(url: assetUrl) To get url I use requestContentEditingInput. The problem is contentEditingInput can be empty. I have had cases where my app worked on my new iphone the first few times. But after some tries, this problem was gone and contentEditingInput was always not empty. Not sure but I think it is because all assets were cached. So my questions are: Why contentEditingInput can be empty? How can to get asset url if contentEditingInput is empty? How can I clear asset photos cache to reproduce this issue if it is related to cache? Part of code which I use: extension PHAsset { func getURL(completionHandler: @escaping ((_ responseURL: URL?) -> Void)) { let options: PHContentEditingInputRequestOptions = PHContentEditingInputRequestOptions() options.canHandleAdjustmentData = { (adjustmeta: PHAdjustmentData) -> Bool in return true } options.isNetworkAccessAllowed = true self.requestContentEditingInput(with: options, completionHandler: { (contentEditingInput: PHContentEditingInput?, info: [AnyHashable: Any]) -> Void in !!!!!!contentEditingInput can be empty completionHandler(contentEditingInput?.fullSizeImageURL as URL?) }) } md5: func md5File(url: URL, isCancelled: @escaping () -> Bool) -> Data? { let bufferSize = 1024 * 1024 do { // Open file for reading: let file = try FileHandle(forReadingFrom: url) defer { file.closeFile() } // Create and initialize MD5 context: var context = CC_MD5_CTX() CC_MD5_Init(&context) // Read up to `bufferSize` bytes, until EOF is reached, and update MD5 context: while autoreleasepool(invoking: { if isCancelled() { return false } let data = file.readData(ofLength: bufferSize) if data.count > 0 { data.withUnsafeBytes { _ = CC_MD5_Update(&context, $0.baseAddress, numericCast(data.count)) } return true // Continue } else { return false // End of file } }) { } if isCancelled() { return nil } // Compute the MD5 digest: var digest: [UInt8] = Array(repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH)) _ = CC_MD5_Final(&digest, &context) return Data(digest) } catch { print("Cannot open file:", error.localizedDescription) return nil } }
0
0
1.2k
Jun ’22
Permission string for camera access
Hello everyone, I'm currently in the app soumission process and I struggle to find a valid permission string, specially for the camera access. Could you give me an example of a permission string for camera access that has worked well for you in the app soumission process ? I wish you a good day ! Charles
Replies
3
Boosts
0
Views
2.3k
Activity
Aug ’23
MPMediaQuery not returning updated results
I have noticed changes Apple Music made to my library, take in particular a changed album edition that is reflected in how the title is listed. I can see the new title in the Music app in two different devices. On one device MPMediaQuery returns the album with the new title. The other device (an iPad with less memory, in case that matters) is still returning the old edition. Is there anything I can do to make sure the data returned is up to date and matches what is seen in the Music app?
Replies
0
Boosts
0
Views
892
Activity
Jul ’23
Extract media information from Apple TV app media (movies and series)
Hi! Is it possible to access metadata information for the personal movie and tv show library? I mean information like the iTunes Store ID, languages, subtitles, has iTunes Extras and maybe even IMDb and TMDB IDs for each title, etc. Is there an API for that like the Apple Music API? I'm no full member of the Apple Developer Program yet, but I'd be very interested if access like with the Apple Music API would also be available for movies and tv shows.
Replies
0
Boosts
0
Views
839
Activity
Jun ’23
My Love for the iPhone: An Unmatched Experience.
**Hey everyone, ** I wanted to share my thoughts and experiences with the iPhone. I've been a proud iPhone user for several years now, and I must say, it has been an incredible journey. The iPhone offers a seamless and intuitive user experience like no other. One of the things I love the most about my iPhone is its exceptional build quality. The sleek design and premium materials make it a joy to hold and use. The retina display is breathtaking, offering vibrant colors and sharpness that truly enhance my multimedia experience. But it's not just about the looks. The performance of the iPhone is unparalleled. From blazing-fast app loading times to smooth multitasking, it handles everything with ease. The A-series chips are powerhouses, ensuring lag-free performance even with resource-intensive tasks. Another standout feature is the App Store. With millions of apps to choose from, I can always find the perfect app to suit my needs. Whether it's for productivity, entertainment, or staying connected with loved ones, there's an app for everything. The camera capabilities of the iPhone are nothing short of remarkable. I'm constantly amazed by the stunning photos and videos I can capture with just a few taps. The advanced camera sensors and image processing algorithms make every shot look professional. The ecosystem integration is where the iPhone truly shines. Seamlessly connecting with my MacBook, iPad, and Apple Watch, I can effortlessly switch between devices and continue my tasks without missing a beat. Features like AirDrop, Handoff, and iCloud syncing make my life so much easier. Security and privacy are also top priorities for me, and the iPhone delivers in these aspects as well. The robust security measures, including Face ID or Touch ID, keep my personal data safe and secure. Overall, the iPhone has become an integral part of my daily life. Its combination of stunning design, powerful performance, remarkable camera, ecosystem integration, and top-notch security make it the ultimate smartphone for me. I couldn't be happier with my choice, and I highly recommend it to anyone looking for an unmatched mobile experience. So, fellow iPhone users, what are your favorite features and experiences? Let's share our love for this incredible device! Cheers, James
Replies
1
Boosts
0
Views
1.3k
Activity
Jun ’23
MPMediaLibrary.default().addItem broken in macOS 13.4 / Catalyst
The following line of code worked fine in macOS 13.3 / Catalyst: try await MPMediaLibrary.default().addItem(withProductID: "1678639572") Since the 13.4 update it now throws an error: The operation couldn’t be completed. (MPErrorDomain error 11.) Although the Apple Music track with catalog Id 1678639572 does seem to get added to the library regardless. MPError.errorCode 11 is an undocumented value. Can someone please advise what error code 11 actually means, and if there's a workaround? I've raised this as feedback id FB12196635.
Replies
0
Boosts
0
Views
1k
Activity
May ’23
video in my gallery stuttering after editing it with iphone's inbuilt editing tools
I have an apple iphone 11 pro and there are a few videos which when edited with iphone's inbuilt editing tools, the video stutters. Please help
Replies
0
Boosts
0
Views
1.1k
Activity
May ’23
Playing apple music from AVFoundation for visualization
Hi I am working on a music app where I can do some sound analysis, my end goal is to integrate Apple Music API in my app where users can search songs. When the song is played I want to show a type of soundwave/spectrogram. For sound visualization I have AVFoundation but the Music API returns only song ID which could be played using Apple MediaPlayer framework only. Is there any API for doing sound analysis or can I play the Apple music songs using AVFoundation.
Replies
4
Boosts
3
Views
2.4k
Activity
Apr ’23
[MPMediaLibrary defaultMediaLibrary] addItemWithProductID: freezing in iOS 14.0.1
I use addItemWithProductID: in the code below to add an Apple Music track to the user's library. This is mature code that's worked fine previously. But now in iOS 14.0.1 it causes the app to freeze. I can trace when running from Xcode or the released app version from App Store and the app freezes after the line: NSLog(@"just before addItemWithProductID %@", productID); The ">>>added..." line is never called. Any idea as to how to remedy? (void) addAppleMusicTrackWithProductID: (NSString *) productID {         NSLog(@" addApplemUsic has been called for productID: %@", productID);         SKCloudServiceController *cloudServiceController;         cloudServiceController = [[SKCloudServiceController alloc] init];         [cloudServiceController requestCapabilitiesWithCompletionHandler:^(SKCloudServiceCapability capabilities, NSError * _Nullable error){             NSLog(@"capabilities: %lu error:%@", (unsigned long)capabilities, error);             if (capabilities >= SKCloudServiceCapabilityAddToCloudMusicLibrary)             {                 NSLog(@"just before addItemWithProductID %@", productID);                 [[MPMediaLibrary defaultMediaLibrary] addItemWithProductID:productID completionHandler:^(NSArray<__kindof MPMediaEntity *> * _Nonnull entities, NSError * _Nullable error) {                     NSLog(@">>>added %@ with %i entities: %@ and  error %@",productID, (int) entities.count, entities, error);                     NSArray *tracksToPlay = [NSArray arrayWithObject:productID];                     [musicPlayer setQueueWithStoreIDs:tracksToPlay];                     [musicPlayer play];                     NSLog(@">>>>now playing AM title:%@ | artist:%@", musicPlayer.nowPlayingItem.title, musicPlayer.nowPlayingItem.artist);                                      }];             }         }]; }
Replies
8
Boosts
0
Views
3.1k
Activity
Apr ’23
Can the app access the voice files in the system voice memos?
I want to implement a function that can read the recording files in voice memos, is there any way other than using iOS Share Extension?
Replies
1
Boosts
0
Views
1.2k
Activity
Mar ’23
Not loading RTSP stream when Local Network permission granted
When i'm trying ‘MobileVLCKit’ to load the rtsp stream (remote camera), iPhone asks to grant access for local network. If Allow access, then the rtsp camera stream don’t play and if Don’t  Allow access, then the rtsp camera stream working fine, and also working on simulator
Replies
2
Boosts
0
Views
1.7k
Activity
Feb ’23
Error returned from daemon: Error Domain=com.apple.accounts Code=7
Hey All, i am getting this error, when i try to pic a picture from library and camera with the help of UIImagePickerController. Anyone have any solution for this? **2022-11-22 12:17:56.241155+0530 ---[10745:2313612] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=7 "(null)"" 2022-11-22 12:17:56.245411+0530 ---[10745:2313614] [PAAccessLogger] Failed to log access with error: access=<PATCCAccess 0x281540780> accessor:<<PAApplication 0x2815403c0 identifierType:auditToken identifier:{pid:10745, version:30182}>> identifier:---kind:intervalEvent timestampAdjustment:0 visibilityState:0 assetIdentifierCount:0 tccService:kTCCServicePhotos, error=Error Domain=NSCocoaErrorDomain Code=4097 "connection to service with pid 7261 named com.apple.privacyaccountingd" UserInfo={NSDebugDescription=connection to service with pid 7261 named com.apple.privacyaccountingd}**
Replies
2
Boosts
3
Views
2.7k
Activity
Nov ’22
MediaLibrary inaccessible on iOS 16.1 for Widget Extensions
Since iOS 16.1 the widgets can no longer access the MediaLibrary even if the authorization is granted. As it can be seen in the screenshot, it is trying to open the MediaLibrary database file but crashes. I've also filed a report via Feedback Assistant, FB11523166
Replies
1
Boosts
0
Views
1.4k
Activity
Nov ’22
Digital Signature Drivers Missing Big Sur
Hi all. IM need help with Big Sur Beta 4, because in betas 1 and 2 the drivers pack from third party like epass2003 Feitian Technology works nice and recognize until update for Beta 4. Is that possible copy or replace some files in system like /usr folder to recognize again this midia? If there a way, please im need help. Im not advanced user. Im think is Java problems and missing dylib files on Big Sur beta 4.
Replies
12
Boosts
0
Views
7.5k
Activity
Oct ’22
Weird error trying to add Apple Music item to library on iPadOS 16.1
I don't know if this is related to the OS version (iPadOS 16.1) but this used to work for me before on this particular device. I'm doing this: try await MPMediaLibrary.default().addItem(withProductID: catalogId) where catalogId is a valid ID I got from MusicKit. This throws the following error: Error Domain=MPErrorDomain Code=0 "An unknown error occurred." UserInfo={NSLocalizedDescription=An unknown error occurred., NSUnderlyingError=0x2814a1b60 {Error Domain=ICCloudClientErrorDomain Code=2003 "Attempting to retrieve handler for an unsupported configuration" UserInfo={NSLocalizedFailureReason=An ICCloudClient (or HSCloudClient) instance is using a signed-out user identity., NSLocalizedRecoverySuggestion=Listen to ICActiveUserIdentityDidChangeNotification and either update ICCloudClient with the new active account or recreate it, NSLocalizedDescription=Attempting to retrieve handler for an unsupported configuration}}} Not a single Google result for that. The same code on an iPhone with iOS 16.0 works just fine. I tried observing for Notification.Name("ICActiveUserIdentityDidChangeNotification") but that doesn't seem to be fired.
Replies
2
Boosts
0
Views
2.2k
Activity
Sep ’22
xcrun simctl addmedia not working after deleting media
I have deleted the folder : rm -rf ~/Library/Developer/CoreSimulator/Devices/<sim udid>/data/Media/** It deleted the files and I am not able to see in Photos app. But when I try to add media file again with command, I got error: xcrun simctl addmedia <sim udid> abc.png Failed to import 'abc.png', error [PHPhotosErrorDomain] -1: The operation couldn’t be completed. (PHPhotosErrorDomain error -1.) An error was encountered processing the command (domain=com.apple.CoreSimulator.LaunchdSimError, code=133): Multiple errors were returned; see stderr Note: If I do not delete the media then addmedia command working as expected, But I have a scenario where I need to clean all photos then add one file. Simulator version: iOS 15.5 xcrun version: 61
Replies
2
Boosts
0
Views
1.5k
Activity
Sep ’22
iOS 15.1 Crash: MPMediaLibrary.authorizationStatus
I’d appreciate some help in diagnosing a crash in MPMediaLibrary that occurs on some iOS 15.1.x user devices. So far this issue can't be reproduced with test devices that range from iOS10 to iOS15.2, whether via Xcode 12.4 or TestFlight. The app needs access to the device’s microphone and audio files which are selected via the MPMediaPickerController. The usual usage description keys (namely NSMicrophoneUsageDescription, NSAppleMusicUsageDescription and kTCCServiceMediaLibrary) are specified in the info.plist. The crash relates to library access and involves the iTunesCloud binary. The crash occurs when the app starts, probably for the first time after installation (not the best way to greet new users). Here is a sample crash report: iOS15_1_Crash_MPMediaLibrary_authorizationStatus_anon.txt Here is a typical traceback: Thread 0 Crashed: 0  libsystem_kernel.dylib           0x00000001b8964504 mach_msg_trap + 8 1  libsystem_kernel.dylib           0x00000001b8964b9c mach_msg + 76 (mach_msg.c:119) 2  libdispatch.dylib                0x000000018165227c _dispatch_mach_send_and_wait_for_reply + 520 (mach.c:815) 3  libdispatch.dylib                0x000000018165262c dispatch_mach_send_with_result_and_wait_for_reply + 56 (mach.c:2019) 4  libxpc.dylib                     0x00000001f2576b9c xpc_connection_send_message_with_reply_sync + 240 (connection.c:974) 5  TCC                              0x00000001e961c0c0 tccd_send_message + 940 (TCC.c:490) 6  TCC                              0x00000001e9621e08 __TCCAccessRequest_block_invoke.213 + 876 (TCC.c:591) 7  libdispatch.dylib                0x0000000181637660 _dispatch_client_callout + 20 (object.m:560) 8  libdispatch.dylib                0x00000001816468b4 _dispatch_lane_barrier_sync_invoke_and_complete + 56 (queue.c:1016) 9  libsystem_trace.dylib            0x000000019c147668 _os_activity_initiate_impl + 64 (activity.c:131) 10 TCC                              0x00000001e961d4e0 TCCAccessRequest + 476 (TCC.c:1019) 11 TCC                              0x00000001e961c73c TCCAccessPreflight + 300 (TCC.c:1651) 12 iTunesCloud                      0x0000000198d58160 -[ICCloudServiceStatusMonitor authorizationStatusForScopes:] + 60 (ICCloudServiceStatusMonitor.m:689) 13 MediaPlayer                      0x000000018a8c8ee4 +[MPMediaLibrary authorizationStatus] + 64 (MPMediaLibrary.m:778) 16 MyAppppp                         0x00000001003e9880 AppDelegate.application(_:willFinishLaunchingWithOptions:) + 32 (AppDelegate.swift:23) 17 MyAppppp                         0x00000001003e9880 @objc AppDelegate.application(_:willFinishLaunchingWithOptions:) + 136 (<compiler-generated>:20) The app startup logic is basically: func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { let audioSession = AVAudioSession.sharedInstance() if audioSession.recordPermission == .undetermined { audioSession.requestRecordPermission { // Permission initialized } } if MPMediaLibrary.authorizationStatus() == .notDetermined // Sometimes crashes in iOS15.1 on user devices { MPMediaLibrary.requestAuthorization { // Permission initialized } } if MPMediaLibrary.authorizationStatus() == .authorized { // The following code sometimes crashes in iOS15.1 on user devices without the enclosing ".authorized” check let predicate = MPMediaPropertyPredicate(value: defaultSongId, forProperty: MPMediaItemPropertyPersistentID) let query = MPMediaQuery() } return true } Questions: What exactly is the iTunesCloud binary doing? Is additional configuration needed? Why does the crash happen only on some iOS 15.1 user devices? Is it too early in the app lifecycle to call MPMediaLibrary.authorizationStatus? Post-crash workaround: Are users able to grant access to the library via the device’s global privacy settings? Thanks!
Replies
7
Boosts
0
Views
3.5k
Activity
Aug ’22
MPMusicPlayerControllerNowPlayingItemDidChange unexpected behavior
Hello all, I have currently a music app where I set a track from the playlist to play and queue the next one. So 1 track gets played and we prepare the next one by inserting it in the queue. I'm using MPMusicPlayerControllerNowPlayingItemDidChange API to get notified when a track has changed (aka ended) so that I get to queue the next one. In this way we make sure that we always have the next track ready to play in the queue (also if the user decides to hit next in lock screen). Now, hitting the "next" button on the lock screen will correctly go through the tracks which tells me the queue is working properly. BUT if I just let the tracks finish on their own then this logic isn't working correctly. The problem I'm facing is that now when one of the songs ends the API returns nowPlayingItem one of the previous songs, thus repeating the previous track and breaking the implemented logic. I'm facing this in iOS 15.5 and I know this used to work in the past. I'm not sure at what version it broke but I wanted to see if there's others that are expecting the same behavior and if somebody is looking into this issue.
Replies
0
Boosts
0
Views
1.1k
Activity
Aug ’22
Request: An API to remove from Library/Playlist.
I understand why there isn’t an API to remove items from the library or playlist, but I propose a way to safely remove items from the library or playlist which would show a system alert to confirm the removal. This is exactly how the deletion is allowed for the Photos Library via third-party apps.
Replies
2
Boosts
1
Views
1.3k
Activity
Jul ’22
Converting MusicKit's Song (MusicItem) to MPMediaItem!
Hi , I have a usecase where I need to add multiple songs to apple music playlists. I am using MPMediaplaylist.addItem(withProductID: ) function to add a single song to the playlist. Is there a way to convert the song to MPMediaItem so that I can use MPMediaplaylist.add([MPMediaItem]) to add multiple songs to the playlist? Regards
Replies
2
Boosts
1
Views
1.4k
Activity
Jun ’22
requestContentEditingInput fullSizeImageURL is empty
I try to get fullSizeImageURL and then calculate md5 of asset via url: var assetUrl = syncUrl(asset: asset) let assetMD5 = md5File(url: assetUrl) To get url I use requestContentEditingInput. The problem is contentEditingInput can be empty. I have had cases where my app worked on my new iphone the first few times. But after some tries, this problem was gone and contentEditingInput was always not empty. Not sure but I think it is because all assets were cached. So my questions are: Why contentEditingInput can be empty? How can to get asset url if contentEditingInput is empty? How can I clear asset photos cache to reproduce this issue if it is related to cache? Part of code which I use: extension PHAsset { func getURL(completionHandler: @escaping ((_ responseURL: URL?) -> Void)) { let options: PHContentEditingInputRequestOptions = PHContentEditingInputRequestOptions() options.canHandleAdjustmentData = { (adjustmeta: PHAdjustmentData) -> Bool in return true } options.isNetworkAccessAllowed = true self.requestContentEditingInput(with: options, completionHandler: { (contentEditingInput: PHContentEditingInput?, info: [AnyHashable: Any]) -> Void in !!!!!!contentEditingInput can be empty completionHandler(contentEditingInput?.fullSizeImageURL as URL?) }) } md5: func md5File(url: URL, isCancelled: @escaping () -> Bool) -> Data? { let bufferSize = 1024 * 1024 do { // Open file for reading: let file = try FileHandle(forReadingFrom: url) defer { file.closeFile() } // Create and initialize MD5 context: var context = CC_MD5_CTX() CC_MD5_Init(&context) // Read up to `bufferSize` bytes, until EOF is reached, and update MD5 context: while autoreleasepool(invoking: { if isCancelled() { return false } let data = file.readData(ofLength: bufferSize) if data.count > 0 { data.withUnsafeBytes { _ = CC_MD5_Update(&context, $0.baseAddress, numericCast(data.count)) } return true // Continue } else { return false // End of file } }) { } if isCancelled() { return nil } // Compute the MD5 digest: var digest: [UInt8] = Array(repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH)) _ = CC_MD5_Final(&digest, &context) return Data(digest) } catch { print("Cannot open file:", error.localizedDescription) return nil } }
Replies
0
Boosts
0
Views
1.2k
Activity
Jun ’22