Integration
The P101XP SDK is fully implemented in Swift
Attention starting with sdk version 1.53.17, the P101XP class has been renamed to P101XPSDK.
To integrate 101XP Mobile SDK into your app please perform the following actions:
- Get the latest version of SDK using CocoaPods (iOS)
- Integrate SDK into your application. The integration may be partial, however, some modules must be integrated: Authorization, Billing, Analytics and Firebase Crashlytics.
CocoaPods
1. To setup CocoaPods, please use the script setup_sdk_stage.sh or setup_sdk_release.sh (please, ask your release manager if you're not sure which script you want)
$ chmod +x setup_sdk_release.sh
$ ./setup_sdk_release.sh
2. Then, if you don't have Podfile, create it by running the command in the project's directory.
$ pod init
3. Add parameters plugin and pod 'P101XP' to your Podfile
platform :ios, '13.0'
plugin 'cocoapods-art', :sources => [
'p101xp-release'
]
source ’https://github.com/CocoaPods/Specs.git'
target 'P101XP-sample' do
use_frameworks!
pod 'P101XP'
end
post_install do | installer |
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
config.build_settings["DEVELOPMENT_TEAM"] = "DC7LZQ72AT"
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
end
While adding parameters to the Podfile, make sure use_frameworks! is not commented and platform :ios, '13.0' is added
4. Install pod for 101XP SDK and open the .xcworkspace file with the project.
$ pod repo-art update p101xp-release
$ pod install
$ open P101XP-sample.xcworkspace
4. To build on the simulator, you need to add to Excluded Architectures:
Importing 101XP SDK into Objective-C
- Under Build Settings, in Packaging, make sure the Defines Module setting for that framework target is set to Yes.
- Import the Swift code from that framework target into any Objective-C .m file within that target using this syntax and substituting the appropriate names.
#import <P1010XP/P1010XP-Swift.h>
When declarations in an Objective-C header file refer to a Swift class or protocol that comes from the same target, importing the generated header creates a cyclical reference. To avoid this, use a forward declaration of the Swift class or protocol to reference it in an Objective-C interface.
// MyObjcClass.h
@class P101XPProduct;
@protocol P101XPDelegate;
@interface MyObjcClass : NSObject
- (P101XPProduct *)returnSwiftClassInstance;
- (id <P101XPDelegate>)returnInstanceAdoptingSwiftProtocol;
// ...
@end
Updating 101XP SDK via CocoaPods
To update 101XP SDK you can run the script from the project directory with your Podfile:
./setup_sdk_release.sh
Or with the following commands:
$ pod repo-art update p101xp-release
$ pod update
List of required permissions
Add the following permissions to the application Info.plist:
<key>NSPhotoLibraryUsageDescription</key>
<string>This app requires access to the photo library.</string>
<key>NSCameraUsageDescription</key>
<string>This app requires access to the camera.</string>
<key>NSCalendarsUsageDescription</key>
<string>Advertising</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Advertising</string>
Localization
Add to your Info.plist for English, Russian support:
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>ru</string>
</array>