An MPMediaLibrary object, or media library, represents the state of the set of synced media items (such as songs) on a device. The complete library of media items itself is called the iPod library.
Questions tagged [mpmedialibrary]
34 questions
1
vote
1 answer
authorization for media library dose not run the handler
MPMediaLibrary.requestAuthorization { (status) in
if status == MPMediaLibraryAuthorizationStatus.authorized {
print("Accepted")
} else {
print("not authorized")
}
}
The code above worked fine until…

mehdi
- 2,703
- 1
- 13
- 15
1
vote
1 answer
Setting title when requesting permissions?
I am requesting permissions for the Music Library but this question is equally appropriate for any permissions that can be requested.
I have set the key and value in the project plist:
Privacy - Media Library Usage Description: Access to Media…

sam_smith
- 6,023
- 3
- 43
- 60
1
vote
1 answer
Removing a playlist from iOS MPMediaLibrary
MPMediaLibrary contains the api for creating a new playlist:
https://developer.apple.com/documentation/mediaplayer/mpmedialibrary
func getPlaylist(with uuid: UUID, creationMetadata: MPMediaPlaylistCreationMetadata?, completionHandler: @escaping…

Jonathan
- 614
- 1
- 9
- 18
1
vote
0 answers
iOS 10 requestAuthorization
I don't know what's the wrong with this code, it always shows me this thing:fatal error: unexpectedly found nil while unwrapping an Optional value
I got that thing when I try to get access to MPMediaLibrary, the code is this:
if…

ash moon
- 47
- 1
- 10
1
vote
0 answers
Crash in getPlaylistWithUUID
Am I doing something wrong? This seems pretty simple. It seems getPlaylistWithUUID is calling UUIDString on UUID which ought to work but for some reason the value goes into the method as an NSCFString. This is Swift 2.3
I've filed a bug report but…

rjb101
- 514
- 5
- 14
1
vote
1 answer
Using MPMediaLibrary to add song to playlist
I am creating an app to that allows you to add a song into your music library but I can only add them to the music library. It works but I have noticed Shazam can add them to specific playlists
Do they have special access or am I completely missing…

Carlos Perez
- 122
- 2
- 12
1
vote
1 answer
is there any way to search multiple artists tracks from iPod Library at a time .
I wants to get multiple artists tracks from iPod Library . The following code allow me to get specific artist tracks like -
MPMediaQuery *query = [[MPMediaQuery alloc] init];
[query addFilterPredicate: [MPMediaPropertyPredicate
…

Anupam Mishra
- 3,408
- 5
- 35
- 63
1
vote
3 answers
Sort Albums by Artist using MPMediaQuery
I'm trying to access the user’s local music library using MPMediaQuery to sort the results in the following manner:
Artist A (sorted alphabetically) > All of Artist A's albums, sorted alphabetically
Artist B (sorted alphabetically) > All of Artist…

David Barsky
- 108
- 1
- 3
- 10
0
votes
1 answer
MPMediaLibrary requestAuthorization does execute the code after user accept the permission , Even after using completion handler
enter code hereI have code like this for the permission handler:
func authorizeMediaLibrary(forStatus status: MPMediaLibraryAuthorizationStatus) -> Void{
switch status {
case .authorized:
self.initializeMedia()
case .denied:
…

Buta
- 3
- 2
0
votes
1 answer
How to upload or push songs from my app to iPhone music library in Swift 5
I am building an iOS app in Swift 5 and I am trying to add a song to the user's Apple Music Library, I fetched all the albums, playlists songs using MPMediaLibrary but can't upload it! Is it possible to upload a song to the user's Apple Music…

Yogesh Patel
- 1,893
- 1
- 20
- 55
0
votes
1 answer
Why is my table view only showing about 20 of my items from an array?
My app is not correctly displaying all of the items in my array. What is causing this to happen?
var songamount = ["Refresh Page"]
var songImageAmount = [MPMediaItemArtwork]()
override func viewDidLoad() {
super.viewDidLoad()
…
user10085224
0
votes
1 answer
MPRemoteCommandCenter SomeTimes doesn't show up
I have a music player that uses Superpowered as an audio player. I followed this article to implement a player widget. However, the widget sometimes shows up and many times doesn't.
I want the player widget to show up whenever there is audio…

MrGreen
- 479
- 4
- 24
0
votes
1 answer
Processing image collage for UITableViewCells – Method that would scale for hundreds of cells?
Problem: I am using art assets from music accessed via the apple APIs (all local) to create a 4 image collage as the image in the cell for a playlist in a table view. I have tried a few methods which I will go over to get performance to an…

solenoid
- 954
- 1
- 9
- 20
0
votes
1 answer
I am getting Crash on This for ios 9 however I had a version check already...Please suggest
I am getting the crash for iOS9 According to Crashlytics however I
had put already a version check. Here is the Code I am using :
if ([[[UIDevice currentDevice] systemVersion] floatValue] > 9.0){
[MPMediaLibrary…

Vikesh Prasad
- 779
- 7
- 13
0
votes
0 answers
How to filter out external playlists from Apple Music?
I want to add track to the particular playlist using this method:
- (void)addItemWithProductID:(NSString *)productID completionHandler:(nullable void (^)(NSError * __nullable error))completionHandler;
Currently I am using this filter to filter…

Ramis
- 13,985
- 7
- 81
- 100