Configure your project

Configure your iOS project.


To complete the SDK import process, you must add the player license key and import the JWPlayerController.


Objective-C

  1. In Xcode, open AppDelegate.m.
  2. Set the player license key by calling the JWPlayerController class setPlayerKey in application:didFinishLaunchingWithOptions.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [JWPlayerController setPlayerKey:@"{your_key_here}"]; 
    return YES; 
}

📘

TIP

For added flexibility, you should consider remotely storing the key and setting it at runtime. This approach enables you to update the license key of the player without needing to resubmit your app to the App Store.


  1. Import JWPlayerController.h into any file that will have an embedded player.

    #import <JWPlayer_iOS_SDK/JWPlayerController.h>

You have configured your project. You can now add a player to your view.



Swift

  1. In Xcode, open AppDelegate.swift.
  2. Set the player license key by calling the JWPlayerController class setPlayerKey in application:didFinishLaunchingWithOptions.
func application(_ application: UIApplication, 
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]?) -> Bool {
    // Override point for customization after application launch.
    JWPlayerController.setPlayerKey("[your_key_here}") 
    return true
}

📘

TIP

For added flexibility, you should consider remotely storing the key and setting it at runtime. This approach enables you to update the license key of the player without needing to resubmit your app to the App Store.


  1. Create a bridging header file and import JWPlayerController.h. If Xcode does not display a pop-up window with an option to create a bridging header file, you will have to create this file manually.

You have configured your project. You can now add a player to your view.


📘

TIP

As an alternative to steps 1-2, you can add the player license key to the Info.plist of your app.
• Create a Key named JWPlayerKey.
• From the Type options, select String.
• Set your player license key as the Value.



To minimize security risks, this approach will be deprecated in the upcoming iOS SDK 4.0.



Did this page help you?