Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>-(void)restoreSubscription:(SKPaymentTransaction *)transaction { NSUserDefaults *defaultData = [NSUserDefaults standardUserDefaults]; NSArray *productID = [defaultData objectForKey:@"productID"]; NSArray *subMonths = [defaultData objectForKey:@"SubMonth"]; NSLog(@"%@",productID.description); NSLog(@"Array ==%@",objContantManeger.subscriptionMonth); NSMutableArray *arrID = [[NSMutableArray alloc] initWithArray:objContantManeger.subscriptionProductID]; NSMutableArray *arrMonth = [[NSMutableArray alloc] initWithArray:subMonths]; NSDate *date; NSDate *exDate; for (int i =0;i&lt;arrID.count;i++) { NSString *idStr =[arrID objectAtIndex:i]; NSString *monthStr = [arrMonth objectAtIndex:i]; int addsubMonth = [monthStr intValue]; NSLog(@"%i--%@",i,idStr); NSLog(@"%i--&gt;%i",i,addsubMonth); NSLog(@"Transaction Date--%@",transaction.originalTransaction.payment.productIdentifier); if ([transaction.originalTransaction.payment.productIdentifier isEqualToString:idStr]) { NSLog(@"Date..%@",transaction.originalTransaction.transactionDate); date = transaction.originalTransaction.transactionDate; NSString *dateStr = [date description]; NSRange range; // year range.location = 0; range.length = 4; NSString *yearStr = [dateStr substringWithRange:range]; int year = [yearStr intValue]; NSLog(@"%i",year); // month range.location = 5; range.length = 2; NSString *monthStr = [dateStr substringWithRange:range]; int month = [monthStr intValue]; NSLog(@"%i",month); // day range.location = 8; range.length = 2; NSString *dayStr = [dateStr substringWithRange:range]; int day = [dayStr intValue]; NSLog(@"%i",month); NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *components = [[NSDateComponents alloc] init]; NSLog(@"addsubMonth---)%i",addsubMonth); [components setYear:year]; [components setMonth:month+addsubMonth]; [components setDay:day]; NSLog(@"Expire DATE--&gt;%@",[calendar dateFromComponents:components]); exDate = [calendar dateFromComponents:components]; NSUserDefaults *defult = [NSUserDefaults standardUserDefaults]; [defult setObject:exDate forKey:@"subexpiredate"]; [defult synchronize]; // return; } } </code></pre> <p>You can use this method validate to the subscription.because this is provide subscription start and expire date.</p> <p><strong>Tips--</strong></p> <p>Implement Checking Subscription, using application delegate method applicationDidEnterBackground.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload