iOS Guidelines |

Getting Started with iOS Integration

You can get started with the following:

The latest version of InMobi SDK supports iOS 7 and later. Also, this version of iOS SDK requires XCode 8.0 and later.

Version 6.1.1
Size (.IPA Inflation) 584 KB
SDK Links

Adding the SDK to your Project

Method 1: Integration via Cocoapods (https://cocoapods.org/pods/InMobiSDK)

Follow these steps :

  1. Go to your Xcode project directory and create a pod file using the command below.
    pod init
    			
  2. Add the following to Podfile.
     pod 'InMobiSDK'
     Eg. pod ‘InMobiSDK’
    			
  3. Run the command below to complete the task for dependency.
     pod install
    			

    Workspace with pods is created.

Method 2: Integrating the framework directly

Add the following MANDATORY frameworks to your Xcode project:

  • InMobiSDK.framework from the downloaded InMobi iOS SDK bundle
  • libsqlite3.0.tbd
  • libz.tbd
  • WebKit.framework

Add -ObjC flag to the Other Linker Flags:

  1. Open your project in Xcode.
  2. Select Application Target > Build Settings.
  3. In the Search box, search for Other Linker Flags.
  4. Add the -ObjC flag

Preparing your App for iOS 10

App Transport Security (ATS), a default setting introduced with iOS 9 that mandates apps to make network connections only over TLS version 1.2 and later. Though InMobi is committed towards the adoption of HTTPS, the current setup requires our demand partners to support this change and be 100% compliant with all the requirements of ATS.

While we work with our partners progressing towards a secure environment by January 2017, to ensure ads work on iOS 9 and later versions, you need to follow these steps as a near-term fix:

  • Disable ATS (Recommended) - to ensure non-secure content from the partners work correctly in your updated apps. To disable ATS flag, add the following code snippet to your app's Info.plist.

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>
    			
  • Disable ATS with exceptions (Not Recommended) - in case you plan to migrate towards ATS compliance. You can achieve so by allowing secure content from your domains by adding them on the exception list.
    	<key>NSAppTransportSecurity</key>
       	<dict>
              <key>NSAllowsArbitraryLoads</key>
        	  <true/>
               <key>NSExceptionDomains</key>
            	<dict>
                  	  <key>example.com</key>
                 	  <dict>
                      	<key>NSIncludesSubdomains</key>
                      	<true/>
                  	  </dict>
             	</dict>
        	</dict>
    			

Note: Refrain from using InMobi domains and CDN in the exception list as it will result in errors during the runtime.

Initializing the SDK

  1. Import the InMobi SDK header in your AppDelegate.h file:
    @import InMobiSDK;
    			
  2. Initialize the SDK in the didFinishLaunchingWithOptions method within the app delegate's .m file:
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {    
    	//Initialize InMobi SDK with your account ID
    [IMSdk initWithAccountID:@"Insert InMobi account ID here"];
    	// Do your stuff.
    	return YES;
    }
    			

    Find your account id from your account interface as shown in the image below.

  3. Pass the location information to allow better ad targeting.
  4. Note: If the location object is passed, the app will ask the user for permission to access their location information. Set NSLocationWhenInUseUsageDescription flag to (description for asking location permission) in your info.plist file.

    //Using <CoreLocation/CoreLocation.h> fetch the coordinate
       CLLocationManager *mgr = [[CLLocationManager alloc] init];
       CLLocation *loc = mgr.location;
       [IMSdk setLocation:loc];
      [locationMgr];
    			
  5. Pass age and gender information to allow better ad targeting. Ensure that you have user consent to share this data.
    The following values are supported:
    Age Gender
    • kIMSDKAgeGroupBelow18
    • kIMSDKAgeGroupBetween18And20
    • kIMSDKAgeGroupBetween21And24
    • kIMSDKAgeGroupBetween25And34
    • kIMSDKAgeGroupBetween35And54
    • kIMSDKAgeGroupAbove55
    • kIMSDKGenderMale
    • kIMSDKGenderFemale
    [IMSdk setGender:kIMSDKGenderFemale];
    [IMSdk setAgeGroup:kIMSDKAgeGroupBetween25And34];
    			

Start monetizing your iOS app with these ad formats: