You used valueForKey:
that's why the error happening. Use valueForProperty:
like:
NSLog(@"Track Number %@", [mediaItem valueForProperty:MPMediaItemPropertyAlbumTrackCount]);
In the MPMediaItem Class Referece Apple says that:
You obtain metadata for a media item by calling the valueForProperty method with these property keys.