AdFalcon iOS SDK Integration guide contains all the information needed for iOS developers to integrate with AdFlacon Network. The guide will also show examples and code snippets on how to perform the integration.
- Xcode: 9.0 or higher
- Development target: iOS 9.0 or higher
- CocoaPods to manage library dependencies with your Xcode projects (Recommended). for more information about CocoaPods visit cocoapods site
There are two ways to install our SDK:
To use the CocoaPods you should implement the steps below, For more info visit: https://cocoapods.org/pods/AdFalconSDK
The below steps illustrate the needed steps to initialize and prepare the CocoaPods.
- Open the terminal app from your applications
- If you haven’t installed the CocoaPods before, run this command from the terminal: sudo gem install cocoapods
- Go to your project’s directory by running this command: cd [path of your project]
- Create CocoaPods to your project by running this command: pod init
- Open your project’s directory, you will find the CocoaPods project was installed and ready.
After creating the CocoaPods project, you will find Podfile within the project’s directory. Open it via TextEdit or Xcode, then insert the below pod (pod ‘AdFalconSDK’) to your target
platform :ios, '9.0' target 'YourProjectTarget' do pod 'AdFalconSDK' end
Run the below command to install AdFalcon’s pod to your project.
To be sure to get the latest iOS SDK into your project, run the below command from the terminal in the same path of Podfile’ directory.
Follow the procedure below to manually add AdFalcon SDK framework to your project:
- Download AdFalcon iOS SDK.
- Unzip the downloaded zip file, you will find AdFalconSDK.framework in the Framework folder.
- Add the framework to your “Link Binary With Libraries” in “Build Phases” of your project’s target.
You must add -ObjC linker flag to your project; if you forget adding the linker flag, the “Selector not recognized” exception will be raised during the runtime.
follow these steps to add -ObjC:
- In Xcode, choose View > Navigators > Show Project Navigator, or press ⌘
- Select your project under the PROJECT heading in the Project Navigator, then select the Build Settings tab.
- Scroll down to the Other Linker Flags build setting under the Linking collection, or type “Other Linker Flags” into the search bar.
- Set the value of the Other Linker Flags build setting to -ObjC.
If you build your app with iOS SDK 9.0 or later, you will need to turn off App Transport Security in your app’s plist in order to complete AdFalcon SDK integration successfully as below:
NSAppTransportSecurity NSAllowsArbitraryLoads NSAllowsArbitraryLoadsForMedia NSAllowsArbitraryLoadsInWebContent
Enabling Test Mode
During development, you can enable test mode and display test ads that will mimic real ads in terms of placement, behavior and events. To do so, you need to enable test mode by following the below steps:
- Complete the steps mentioned in the following help topics to add our components including the code to request ads.
- Run your app in debug to request your first ad.
- Check the debug console which should contain a message as follows:
**** AdFalcon: Use ADFTargetingParams to receive test ads **** ADFTargetingParams * targetingParams = [ADFTargetingParams new]; targetingParams.testDevicesIDs = @[@"See Note Below""];
- Modify your code to use the above code.
Note: This will enable test mode for only the device which you used in step 2-3.