I need a guide for adding trial period option for iOS app auto-renewing subscription without using separate server.
The thing is that different time period options inside one auto-renewing group of items have separate IDs, however there is no ID for trial period. How can I request it from out my app after user presses "Trial period" button.
There are no descriptions on Developer Forums and on other websites, no examples as well, so I don't know how to implement this.
P.S.: I use RMStore to cover transaction APIs.
Here is how the code approximately looks:
- (void)performRequestForProduct:(NSString *)productID completionBlock:(void(^)(BOOL success))func {
NSSet *productIdentifiers = [NSSet setWithObjects:kInAppIDUltimate, kInAppIDPremium1Year, kInAppIDPremium1Month, kInAppDonationBundleID, nil];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];
[[RMStore defaultStore] requestProducts:productIdentifiers success:^(NSArray *products, NSArray *invalidProducts) {
if (invalidProducts.count)
NSLog(@"Products invalid requested are %@", invalidProducts);
if (DEBUGGING)
for (SKProduct *product in products)
NSLog(@"Product valid is %@ (%@, %@)", product.localizedTitle, product.localizedDescription, product.price);
[[RMStore defaultStore] addPayment:productID success:^(SKPaymentTransaction *transaction) {
[[RMStore defaultStore].receiptVerificator verifyTransaction:transaction success:^ {
if ([productID isEqualToString:kInAppIDUltimate]) {
[GLOBAL_DEFAULTS_CONTAINER setObject:@"1" forKey:kNSUserDefaultInAppPurchaseExpirationDate];
} else if ([productID isEqualToString:kInAppIDPremium1Month] || [productID isEqualToString:kInAppIDPremium1Year]) {
[GLOBAL_DEFAULTS_CONTAINER setObject:[FORMATTER_DATE stringFromDate:expirationDate] forKey:kNSUserDefaultInAppPurchaseExpirationDate];
}
[GLOBAL_DEFAULTS_CONTAINER synchronize];
[self reloadData];
}];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
} failure:^(NSError *error) {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
PRINT_ERROR(error);
}];
} failure:^(SKPaymentTransaction *transaction, NSError *error) {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}];
} failure:^(NSError *error) {
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}];
};