You can get started with the following:
The latest version of InMobi SDK supports iOS 9 and later. Also, this version of iOS SDK requires XCode 9.0 and later.
Method 1: Integration via Cocoapods (https://cocoapods.org/pods/InMobiSDK)
Follow these steps :
pod init
Podfile
.
pod 'InMobiSDK' Eg. pod ‘InMobiSDK’
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 bundlelibsqlite3.0.tbd
libz.tbd
WebKit.framework
Add
-ObjC
flag to the Other Linker Flags:
-ObjC
flag
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, to ensure ads work on iOS 9 and later versions, you need to follow these steps as a near-term fix:
Info.plist
.
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
<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.
AppDelegate.h
file:
@import InMobiSDK; /**Please do not remove the window property as it can lead to undefined behavior**/ // @property (strong, nonatomic) UIWindow *window;
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"consentDictionary:@{<Insert consentObject dictionary here>}]; // Do your stuff. return YES; }
consentObject
is a dictionary representation of all kind of consent provided by the publisher to the SDK. The key is mandatory if you wish to monetize traffic from EEA region. You can read further on GDPR regulations here.
Key | Type | Inference |
gdpr_consent_available | String |
"true" - Publisher has provided consent to collect and use user’s data.
"false" - Publisher has not provided consent to collect and use user’s data. Any value other than “true” and “false” is invalid and will be treated as value not provided by publisher, i.e. empty value. |
gdpr | String | Whether or not the request is subject to GDPR regulations, deviation from (0 = No, 1 = Yes ) indicates an unknown entity. |
The key gdpr_consent_available can be accessed via string constant
IM_GDPR_CONSENT_AVAILABLE
.
Important
consentObject
in every session. The SDK does not persist consent, it only keeps the consentObject
in memory. If the app is relaunched or it crashes - SDK will lose the consentObject
.
IMSdk.updateGDPRConsent(<Insert consentObject dictionary here>)
Recommended: If your app collects location from the user, we recommend passing it up, as impressions with location signal have higher revenue potential. InMobi SDK will automatically pass the location signals if available in the app. If you use location in your app, but would like to disable passing location signals to InMobi, then TURN OFF the “Location Automation” for your property on the InMobi dashboard.
Otherwise: You can set NSLocationWhenInUseUsageDescription
flag (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];
Age | Gender |
|
|
[IMSdk setGender:kIMSDKGenderFemale]; [IMSdk setAgeGroup:kIMSDKAgeGroupBetween25And29];
Start monetizing your iOS app with these ad formats:
Thank you for voting!