iPhone App Video Mirroring in Three Easy Steps

I got an email that said:

Hi I am a complete newbie to Xcode and programing in Cocoa and I was wondering if I cout get some help or a brief tutorial on implementing the UIApplication+TVOut.m in a small project and I am trying to build please any and all help would greatly be appreciated

Sure, it’s pretty simple:

  1. Add the file “UIApplication+TVOut.m” (download link) to your XCode project. (i.e. Drag the file from the desktop into the project window’s list of files; check the “copy files” option if you want.)
  2. In your project’s file list, right click on the “Frameworks” group item, and pick “Add existing framework”. Pick the “MediaPlayer.framework” framework.
  3. In your project’s file list, there should be an app delegate file. It’ll be named whatever you called the project, i.e. “MyTestProjectAppDelegate.m”. In that file, find the method called “applicationDidFinishLaunching:” and add “[application startTVOut];” to it, like this:
  1. - (void)applicationDidFinishLaunching:(UIApplication *)application {
  3.  [application startTVOut];
  5. }

That’s all there is to it.

That will generate a warning upon build, since we didn’t define “startTVOut” in a header anywhere, but it’s safe to ignore it. (If you’re the kind of person who always turns on “treat warnings as errors,” then there’s one more step — also add (and #import) the header file, UIApplication+TVOut.h.)

This entry was posted on Wednesday, November 4th, 2009 at 7:29 am and is filed under Cocoa Touch, iPhone Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

Your comment