支付宝SDK的 报网络繁忙的错。

前端之家收集整理的这篇文章主要介绍了支付宝SDK的 报网络繁忙的错。前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<table class="css"><tr class="li1">
<td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

系统繁忙,请稍后再试 前言   支付宝的iOS SDK真是个奇葩的存在 按理说这么重要的SDK 理应提供详尽的文档和技术支持虽然说实际使用较简单 但是跑到官方论坛一看 都是各种各样的问题 以及千篇一律的解答   这里不谈如何集成和使用SDK 只谈问题 如果你按照官方文档一步一步的调试发现任何问题没有 那么 恭喜你 运气不错   如果你跟我一样 遇到跳转支付时现实”系统繁忙请稍后再试” 的问题如图 没截到iOS的 找了一张android的图凑数   问题   官方示例中支付相关的代码   //构造订单 NSString appScheme @ NSString orderInfo self getOrderInfoindexPath.row NSString signedStr self doRsaorderInfo   //形成订单参数 NSString orderString NSString stringWithFormat@%@\%@\                          orderInfo signedStr @   //调用支付借口 AlixLibService payOrderorderString AndSchemeappScheme seletor_result self   问题就出在orderInfo这里 那么orderInfo是什么呢? -NSStringgetOrderInfoNSIntegerindex     获取prodcut实例并初始化订单信息     Product product _products objectAtIndexindex         AlixPayOrder AlixPayOrder alloc init     order PartnerID     order SellerID       order self generateTradeNO //订单ID(由商家自行制定)     order product.subject //商品标题     order product.body //商品描述     order NSString stringWithFormat@product.price //商品价格     order  @ //回调URL         return description 可以到看orderInfo就是AlixPayOrder的字符串化 再看看其description函数 - NSString description     NSMutableString discription NSMutableString string     discription appendFormat@%@\ self ? self @     discription appendFormat@%@\ self ? self @     discription appendFormat@%@\ self ? self @     discription appendFormat@%@\ self ? self @     discription appendFormat@%@\ self ? self @     discription appendFormat@%@\ self ? self @     discription appendFormat@%@\ self ? self @         discription appendFormat@%@\ self ? self @     discription appendFormat@%@\ self ? self @     discription appendFormat@%@\ self ? self @       //下面的这些参数,如果没有必要(为空),则无需添加     discription appendFormat@%@\ self ? self @     discription appendFormat@%@\ self ? self @     discription appendFormat@%@\ self ? self @           for NSString key in self allKeys         discription appendFormat@%@\ key self objectForKeykey         return discription 我猜问题可能出现在这里   discription appendFormat@%@\ self ? self @ discription appendFormat@%@\ self ? self @ discription appendFormat@%@\ self ? self @ 可能是这种莫名其妙的默认值导致了问题的出现代码里注释了无需添加 可为啥官方demo是没有问题的? orderInfo也不过是一堆参数的拼凑而已 同时 我求证了同事在android的sdk里 参数也都是手工拼凑的 那么将必填参数自行组织一下 应该就可以了   方案   经过实践 只需要填下下面出现的这些参数 就没有问题了   -NSStringgetOrderInfo         NSMutableString discription NSMutableString string     discription appendFormat@%@\ PartnerID     discription appendFormat@%@\ SellerID     discription appendFormat@%@\ self getOrderID     discription appendFormat@%@\ yourSubject     discription appendFormat@%@\ yourBody     discription appendFormat@%@\ yourPrice     discription appendFormat@%@\ yourHandleAction     discription appendFormat@%@\ @         return discription 尾声   当然 回过头来看 问题有这么几个   官方demo写得不严谨 且注释太少 官方文档写没有指出相关问题 以及对相应参数的解释对于参数仅提到了一句”支付参数提交时需要组装订单信息 orderInfo其中 参数以 key”形式呈现参数之间以“&”分割 获取 Alipay 支付对象调用支付。“” 官方论坛没有相应的技术支持  

猜你在找的程序笔记相关文章