Comments (5)
好像是这里的代码被注释了
iOS/RCTAlipay.m
RCT_EXPORT_METHOD(payInterceptorWithUrl:(NSString *)urlStr
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject) {
[AlipaySDK.defaultService payInterceptorWithUrl:urlStr fromScheme:self.appScheme callback:^(NSDictionary *resultDic) {
resolve(resultDic); // 这里的注释去除
}];
}
另外URL types alipay对应的那一项要写URL Scheme,随便写个纯字母的字符串就可以了
from react-native-alipay.
好像是这里的代码被注释了
iOS/RCTAlipay.mRCT_EXPORT_METHOD(payInterceptorWithUrl:(NSString *)urlStr resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) { [AlipaySDK.defaultService payInterceptorWithUrl:urlStr fromScheme:self.appScheme callback:^(NSDictionary *resultDic) { resolve(resultDic); // 这里的注释去除 }]; }
@0x5e 这个是什么原因,可以修复一下吗
from react-native-alipay.
没回调的问题已经解决
解决方法:
AlipayModule.m
#import "AlipayModule.h"
#import <AlipaySDK/AlipaySDK.h>
@implementation AlipayMoudle
RCT_EXPORT_METHOD(pay:(NSString *)orderInfo
resolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject){
NSString *appScheme = @"alipay2019082766518009";
dispatch_async(dispatch_get_main_queue(), ^{
[[AlipaySDK defaultService] payOrder:orderInfo fromScheme:appScheme callback:^(NSDictionary *resultDic) {
resolve(resultDic);
}];
});
}
RCT_EXPORT_MODULE(Alipay);
@EnD
在AppDelegate.m
-
(BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {if ([url.host isEqualToString:@"safepay"]) {
//跳转支付宝钱包进行支付,处理支付结果
[[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:nil];
return YES;
}else{
return [RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation];
}
}
// NOTE: 9.0以后使用新API接口
-
(BOOL)application:(UIApplication *)app openURL:(NSURL )url options:(NSDictionary<NSString, id> *)options
{
if ([url.host isEqualToString:@"safepay"]) {
//跳转支付宝钱包进行支付,处理支付结果[[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:nil];
return YES;
}else{
return [RCTLinkingManager application:app openURL:url options:options];}
}
from react-native-alipay.
推荐使用@uiw/react-native-alipay吧,文档清晰,配置少,很好用的插件。
from react-native-alipay.
@uiw/react-native-alipay
大佬,我的RN是0.57.6版本,可以用这个插件吗?
from react-native-alipay.
Related Issues (20)
- Task :app:transformClassesAndResourcesWithProguardForRelease FAILED HOT 1
- When subject content contains '&' , alipay can't be successfully called.
- Manifest merger failed
- alipaySdk
- 支付宝支付和阿里云推送sdk冲突
- ios build failed HOT 2
- Alipay.setAlipaySandbox failed HOT 5
- Alipay.setAlipaySandbox(true) failed HOT 2
- rn0.61.4 ios 支付完成后不能自动跳转回到APP HOT 5
- iOS手机没有安装支付宝app的情况下,接收不到回调
- Update AlipaySDK to remove UIWebView HOT 5
- Can I delete the comments about uiwebview? IOS store can't submit them HOT 1
- UIWebView替换成WKWebView HOT 1
- ios 没有回调
- ExceptionsManager.js:126 Exception '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]' was thrown while invoking pay on target Alipay with params
- iOS运行报错
- Gradle sync failed: Could not find com.android.tools.build:gradle:4.0.1.
- Failed to resolve: :alipaySdk-15.7.5-20200422171619: Affected Modules: app
- 跟微信冲突了,怎么解决?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-alipay.