This is the shared Robocat toolkit for iOS. The toolkit is managed using CocoaPods and is split up into several small subspecs.
Robokit/Shared
: Shared macros, function, classes and common functionality for rating, following, etc.Robokit/IAP
: IncludesRKPurchaseManager
to make In-App purchases easierRobokit/Ads
: Easy to use Ad banners served by iAd and RevmobRobokit/About
: ViewControllers for About Robocat and subscribing to our newsletter
The shared subscpec contains multiple utility macros, functions and classes along with views for app upgrades,
rating the app, sending feedback and following us. This subspec is included with any of the subspecs of Robokit.
If you only need this part, just add the following line to the Podfile
pod 'Robokit/Shared', :git => 'git@github.com:robocat/Robokit.git'
In your UIApplicationDelegate
add the following line in your application:didFinishLaunchingWithOptions:
:
[TestFlight takeOff:@"app-testflight-token"];
NSString *thisVersionNews = (@"· Awesome new feature\n" @"· Another awesome feature");
[RKSocial initializeSocialFeaturesWithAppId:@"iTunes-App-id-here"
appName:@"AppName"
newInThisVersion:thisVersionNews];
To add support for Flurry analytics add this line to your UIApplicationDelegate
:
[RKSocial initializeFlurryWithAppId:@"flurry-app-id"];
To make things easier add the following line in your MyApp-Prefix.pch
file:
#import <Robokit/Robokit.h>
- RKSocial: automatic popups, rate this app, follow on twitter, like on facebook, subscribe to newsletter
- RKLocalization: Wrapper to the localization API. Convenience functions for localizing UILabels and UIButtons
- RKDispatch: Objective-C wrapper to grand central dispatch
- RKMacros: Handy macros
The What's new popup will displayed everytime a user updates their app. Please make sure you change
the newInThisVersion
parameter of the initialization mentioned above.
The popup for rating the app will automatically be displayed sometime after a user has installed the app or updated the app from a previous version.
If the user rates the app 3 stars or less the feedback popup will appear. The feedback submitted will be sent to both Flurry and TestFlight.
The follow us popup will displayed 2 days after app install or update.
Include RKPurchaseManager
which makes it a lot easier to deal with In-App purchaes.
In your UIApplicationDelegate
's application:didFinishLaunchingWithOptions:
add the following line:
[RKPurchaseManager loadFeaturesWithIds:@[ AD_REMOVE_FEATURE_ID, OTHER_AWESOME_FEATURE_ID ]];
Then you can just add the following line to purchase a feature:
if (![RKPurchaseManager isFeaturePurchased:AD_REMOVE_FEATURE_ID]) {
[RKPurchaseManager purchaseFeature:AD_REMOVE_FEATURE_ID];
}
Or the following line to restore purchases:
[RKPurchaseManager restoreAllPurchases];
There are several notifications you can listen for to handle purchases, restores and errors:
extern NSString * const kRKPurchasesManagerDidLoadProductInfoNotification;
extern NSString * const kRKPurchasesManagerDidPurchaseFeatureNotification; // userInfo: FeatureIdKey => purchased feature ID as NSString
extern NSString * const kRKPurchasesManagerPurchaseDidFailNotification; // userInfo: FeatureIdKey => failed purchase feature ID as NSString
extern NSString * const kRKPurchasesManagerPurchaseWasCancelledNotification; // userInfo: FeatureIdKey => cancelled purchase feature ID as NSString
extern NSString * const kRKPurchasesManagerPurchaseNotAvailableNotification; // userInfo: FeatureIdKey => failed purchase feature ID as NSString
extern NSString * const kRKPurchasesManagerPurchaseRestoreDidFinish;
extern NSString * const kRKPurchasesManagerPurchaseRestoreDidFail; // userInfo: kRKPurchasesManagerErrorKey => error as NSError
extern NSString * const kRKPurchasesManagerFeatureIdKey;
extern NSString * const kRKPurchasesManagerErrorKey;
TODO: Ulrik, add some text here!
Robokit has a subspecificiation for the default About Robocat UIViewController that is used across most of our apps.
Add the following line to the Podfile
to include the code and assets.
pod 'Robokit/About', :git => 'git@github.com:robocat/Robokit.git'