Click here to Skip to main content
15,868,236 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to integrate Stripe with ios. I'm following this guide.

I'm getting stuck here at 'Using an STPCard'.

When I start typing this [Stripe createTokenWithCard:card... Xcodes 'Intelligent code completion' puts a red line through it (kinda like when something is depricated).

Here is the code.

Objective-C
[Stripe createTokenWithCard:card completion:^(STPToken *token, NSError *error) {
    if (error) {
      [self handleError:error];
    } else {
      [self createBackendChargeWithToken:token];
    }
  }];
Posted

1 solution

You are right. It is the standard way to say: "DONT DO THAT!!!" (I hope you get the message ;-)).

My suggestion is to use the function: + (void)createTokenWithCard:(STPCard *)card completion:(STPCompletionBlock)handler;

and write the completion block. Blocks are really fine way to handle long running callbacks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900