To run the example project, clone the repo, and run pod install
from the Example directory first.
PeanutLabs-iOS is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'PeanutLabs-iOS'
Peanut Labs connects your users with thousands of paid online surveys from big brands and market researchers. This SDK allows you to integrate our Reward Center within your iOS application.
The Reward Center lists surveys and offers best suited for each of your members. It is highly customizable and positively engaging.
You get paid whenever your members complete a listing, and get to reward them back in the virtual currency of your choice.
All of this and much more is configured and monitored through our Publisher Dashboard. To learn more and get access to our full set of tools, get in touch with us at [email protected]
Check out our integration guide for step by step instructions on getting up and running with our Reward Center within your iOS application.
v2.1 October 28, 2020
- UIWebView replaced with WKWebView
- due to pending end of 2020 deprecation of UIWebView
v2.0
- Code redesigned using swift and cocopod
v0.6
- Add program id support into ios SDK
v0.5
- Updated iOS SDK bar behavior
- Hide sdk bar for profiler modal
- Hide sdk bar for pre-screener modal
- Hide sdk bar for survey landing page
- 'Back' button for main reward center page sdk bar update
v0.4
- Changed "Done" button to "Home" button and replaced into right side
- Replaced "X" button to "Exit" and moved it to the right side
- After done with survey "Done" button led back to the application, changed it into lead back to rewards center
- Supports custom url parameters
- Supports date of birth url parameter
- Supports gender url parameter
- Automatically sets locale for rewards center depends on device locale
v0.3
- Activity Indicator does not cover the toolbar anymore
- Fixing the frequent connectivity error issue
v0.2
- Always generate new user Id if the user switches account
- Support for all orientations on the iPhone
If you are using the 'default' SDK manager, we reccomend initializing the sdk in the applications 'didFinishLaunchingWithOptions'
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let config = PeanutLabsConfig(appId: 'your app Id', appKey: 'your app key',
endUserId: 'unique end user id', programId: 'program id (can be nil)')
// set isDebug to true if you want to get logs from the SDK
PeanutLabsManager.default.isDebug = true
PeanutLabsManager.default.initialize(with: config)
return true
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
PeanutLabsManager *plManager = [PeanutLabsManager default];
PeanutLabsConfig *config = [[PeanutLabsConfig alloc] initWithAppId:'your app id'
appKey:'your app key'
endUserId:'unique end user id'
programId:'program id (can be nil)'];
// set isDebug to true if you want to get logs from the SDK
[plManager setIsDebug:true];
[plManager initializeWith:config];
return YES;
}
If you want to control which view controller the rewards center is presented on use:
PeanutLabsManager.default.presentRewardsCenter(on: self, with: self)
[[PeanutLabsManager default] presentRewardsCenterOn:self with:self];
If you want to present the rewards center just on top of your application use:
PeanutLabsManager.default.presentRewardsCenterOnRoot(with: self)
[[PeanutLabsManager default] presentRewardsCenterOnRootWith:self];
Setting Dob // MM-DD-YYYY
PeanutLabsManager.default.dob = "MM-DD-YYYY"
Setting gender // PeanutLabsGenderMale or PeanutLabsGenderFemale
PeanutLabsManager.default.gender = PeanutLabsGender(.male|.female)
Setting gender // PeanutLabsGenderMale or PeanutLabsGenderFemale
[[PeanutLabsManager default] setGenderWithGender:PeanutLabsGenderMale|PeanutLabsGenderFemale];
Setting Dob // MM-DD-YYYY
[[PeanutLabsManager default] setDob:@"MM-DD-YYYY"];
PeanutLabsManager.default.add(customVariable: "YOUR VALUE", forKey: "YOUR KEY")
[[PeanutLabsManager default] addWithCustomVariable:@"YOUR VALUE" forKey:@"YOUR KEY"];
Konrad Winkowski, [email protected] Derek Mordarski, [email protected]
PeanutLabs-iOS is available under the MIT license. See the LICENSE file for more info.