用iPhone实现Stripe [英] Implementing Stripe with iPhone

查看:114
本文介绍了用iPhone实现Stripe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Stripe与ios集成。我正在关注 指南。



我卡住了这里 在'使用STPCard'。



当我开始输入这个[Stripe createTokenWithCard:card ... Xcodes'智能代码完成'放一个红色通过它(有点像什么东西被摧毁)。



这是代码。



< pre lang =objc> [Stripe createTokenWithCard:卡片完成:^(STPToken *令牌,NSError *错误){
if (错误){
[ self handleError:error];
} else {
[ self createBackendChargeWithToken:token];
}
}];

解决方案

你是对的。这是标准的说法:不要这样!!! (我希望你得到消息;-))。



我的建议是使用函数:+(void)createTokenWithCard:(STPCard *)卡完成:( STPCompletionBlock)处理程序;



并写入完成块。块是处理长时间运行的回调的好方法


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.

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

解决方案

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


这篇关于用iPhone实现Stripe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆