1
votes
- (void)restorePurchasesButtonTapped {

    [soundManager playTapSound];
    persistor = [RMStore defaultStore].transactionPersistor;

    [[RMStore defaultStore] restoreTransactionsOnSuccess:^{

        if ([persistor isPurchasedProductOfIdentifier:@"RemoveAds"]) {
            [SVProgressHUD showSuccessWithStatus:@"Purchases restored, ads removed!"];
            [FXKeychain defaultKeychain][@"AdsRemoved"] = [NSNumber numberWithBool:YES];
        } else {
            [SVProgressHUD showErrorWithStatus:@"Looks like you don't have any previous purchases!"];
        }


    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"Problem restoring purchases"];
    }];


}

Edit: Sorry for not being clear with the question. The error I'm receiving is the following: "Incompatible block pointer types sending 'void'(^)(void) to parameter of type 'void(^)NSArray*__strong)'

I am not returning an Array but NSArray was mentioned in the bug. If I can give any more information please let me know, kind of new to coding and trying to fix an error from someone else's code project so I don't have a great understanding of the code

2
Welcome to stackoverflow. Please take the time to format proerply your question and have a look to stackoverflow.com/help/how-to-ask - mpromonet
And you need to ask a question along with your code... Not just allude to one in your title. - Lyndsey Scott
Where in your code are you trying to return an nsarray? - Lyndsey Scott
edited the question..anything else i can add to be helpful please let me know and sorry didn't provide full details first time - user3320964

2 Answers

0
votes

It sounds like restoreTransactionsOnSuccess is expecting a different block argument.

Try:

[[RMStore defaultStore] restoreTransactionsOnSuccess:^(NSArray *transactions){
0
votes

The type void (^)(void) is a reference to a block ((^)) which takes no arguments ((void)) and returns nothing (void). The error states this is what you are providing and it is incompatible with the parameter type of void (^)(NSArray * __strong) - which is a reference to a block which takes an array and returns nothing. The definition of the method you are calling is:

- (void)restoreTransactionsOnSuccess:(void (^)(NSArray *transactions))successBlock
                             failure:(void (^)(NSError *error))failureBlock;

You need to provide a success block which accepts a single NSArray * as argument, e.g.:

^ (NSArray *transactions) { ... }

HTH