Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS media picker does not show up
    primarykey
    data
    text
    <p>I am currently working on an audio application on iPhone. It is based on apple's SpeakHere sample code with a user-defined input file from iPod library. </p> <p>Here is the event raised by the button:</p> <pre><code>- (IBAction) btn_PickSong_Clicked:(id)sender{ [self showMediaPicker]; //code importing tracks from library } </code></pre> <p>And in showMediaPicker method:</p> <pre><code>//Yup the program does reach this method but the picker does not show up - (void)showMediaPicker { MPMediaPickerController* mediaPicker = [[[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeMusic] autorelease]; mediaPicker.delegate = self; [self presentModalViewController:mediaPicker animated:YES]; } </code></pre> <p>The problems are: </p> <ol> <li><p>The library import feature works fine in a separate program, but the media picker does not show up anymore when I put the code into <code>SpeakHereController.mm</code>. </p></li> <li><p>Also if I place the showMediaPicker method in another class and call it, it does not work either.</p></li> </ol> <p>Something I find it might be relevant: </p> <ol> <li><p>The original code is in an obj-C file (xxx.m), and now it's transferred into an obj-C++ file (xxx.mm). </p></li> <li><p>I have also modified the base class of <code>SpeakHereController.h</code> from <code>NSObject</code> to <code>UIViewController&lt;MPMediaPickerControllerDelegate&gt;</code> otherwise it will throw a warning that the base class does not contain the required delegate. But in the interface builder it is still displayed as an object (Please refer to SpeakHere sample code).</p></li> <li><p>It seems that it's illegal to convert the built-in <code>xxxViewController.m</code> file to obj-C++ file (.mm extension). In this case a lot of errors will show up if I attempt to do so. Is it true? If so, how to include C++ code in a pure obj-C file?</p></li> </ol> <p>=============</p> <p>So how can I make the media picker show up in this case? Any insight will be appreciated. </p> <p>Thank you very much!</p> <p>Cheers,</p> <p>Manca</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload