Ken Corey
Ken Corey

Reputation: 435

iOS 7 and the MPMediaPicker, why plus?

I've got two strange diverging behaviours between iOS 6 and 7.

I want to present the MPMediaPicker to the end user, allow them to select 1 song, and start playing that back to them.

So, I show them the MPMediaPicker (/not/ multi, and /not/ cloud, if supported).

Two problems:

Thanks!

-Ken

Our MPMediaPicker code:

- (void)showSongPicker {
// TODO check if iOS 6
MPMediaPickerController* songPicker = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeMusic];

songPicker.delegate = self;
songPicker.allowsPickingMultipleItems = NO;

songPicker.showsCloudItems = NO;

[self presentViewController:songPicker animated:YES completion:nil];

[self presentModalViewController:songPicker animated:YES];
}

#pragma mark MPMediaPickerControllerDelegate

- (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection {
MPMediaItem* item = [mediaItemCollection.items objectAtIndex:0];

[self playMediaItem:item];

[self mediaPickerDidCancel:mediaPicker];
}

- (void)mediaPickerDidCancel:(MPMediaPickerController *)mediaPicker {
[self dismissViewControllerAnimated:YES completion:nil];
}

Upvotes: 3

Views: 798

Answers (2)

Ken Corey
Ken Corey

Reputation: 435

Oh! I do apologise. I'd forgotten to answer this.

Since I didn't get an answer from anyone else (until just now, thanks, lap.felix), I filed it as a technical question with Apple.

Their answer? There's no programmatic way to affect the behaviour of the picker. If you need to change the behaviour this "drastically", you have to roll your own media picker.

So...yeah...thanks, Apple.

-Ken

Upvotes: 1

Felix Lapalme
Felix Lapalme

Reputation: 1068

The + doesn't mean anything other than "Add this item to the picker selection"

Upvotes: 0

Related Questions