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:
- 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.)
- In your project’s file list, right click on the “Frameworks” group item, and pick “Add existing framework”. Pick the “MediaPlayer.framework” framework.
- 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:
-
- (void)applicationDidFinishLaunching:(UIApplication *)application {
-
-
[application startTVOut];
-
-
}
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.)