I am trying to install rollout.io its simply it says put thus code in you ApppDelegate the problem is that it is in Objective-C. So i used a converter to try and change it to Swift but it doesn't work when i try to put the Objective-C import header into my code. Even when i try to convert it the Online converter doesn't even show the "import" part
Ive tried these all ready
Code:
import Rollout
import rollout
import UIRollout
all of these fail.
i can get the bottom part in the swift eject but not the top"import ,Rollout/Rollout.h>" part
The following will allow you to setup Rollout SDK in case your AppDelegate is in Swift.
Rollout SDK 1.1.0 has Swift interface for calling the setup, so all the following info is not relevant now.
To call [Rollout setupWithDebug:]
from Swift, you should have Objective-C Bridging Header set and <Rollout/Rollout.h>
should be imported from it:
ObjC-Bridging-Header
SWIFT_OBJC_BRIDGING_HEADER
to point to the file you've created ( ObjC-Bridging-Header.h
). A relative path is required in the setting if the file is not at the project's root - more details in this SO answer Go to the header and add the import line there:
#import <Rollout/Rollout.h>
#if debug
In order to allow Rollout testing mode (for easy hot-patches testing) it's also required to translate #ifdef Debug
from ObjC . This can be done by setting OTHER_SWIFT_FLAGS
in build settings like this:
Now you can add the following lines to application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?)
:
#if DEBUG
Rollout.setupWithKey("<rollout_key>", developmentDevice: true)
#else
Rollout.setupWithKey("<rollout_key>", developmentDevice: false)
#endif
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.