Displaying Web and Multimedia Content
OS X and iOS provide an assortment of APIs to allow you to display web content and streaming multimedia content. In general, if these higher-level multimedia- and web-specific APIs meet your needs, you should use them rather than using networking APIs directly. The sections below briefly summarize these APIs.
Opening Web Content or Streaming Media in the Default Application
To open a webpage or streaming URL in the user’s default browser or media viewer:
For a real-world example, see QA1629: Launching the App Store from an iOS application.
Displaying Web Content in Your Application
OS X and iOS provide an easy way to load and display a webpage with the WebKit engine, the same rendering engine used by Safari.
In OS X, you load web content with the
WebViewclass. You can add a web view by including it in your application’s nib file or by programmatically constructing a
WebViewobject and calling the
initWithFrame:frameName:groupName:method. Load content by calling the
loadRequest:method on the web view’s main frame (which you can obtain with the
In iOS, you load web content with the
loadRequest:method of the
UIWebViewclass. You can add a web view by including it in your application’s nib file or by programmatically creating a
UIWebViewobject and initializing it with the
For more information, see Simple Browsing in WebKit Objective-C Programming Guide (OS X) and UIWebView Class Reference (iOS).
Displaying Streaming Multimedia Content in Your Application
There are several frameworks available for displaying streaming multimedia content in OS X and iOS:
In OS X, use the QTKit Framework for basic playback or the AV Foundation framework for more complex functionality.
In iOS, use the Media Player Framework for basic playback or the AV Foundation framework for more complex functionality.
For more information, read Getting Started with Audio & Video, Multimedia Programming Guide (iOS), QTKit Application Programming Guide (OS X), and AVFoundation Programming Guide.