ios 微信 支付

2021-07-07 03:05:34 字數 1608 閱讀 2529

2、將sdk檔案中包含的 libwechatsdk.a,wxapi.h,wxapiobject.h 三個檔案新增到你所建的工程中

3、匯入對應的庫檔案:

systemconfiguration.framework,libz.dylib,libsqlite3.0.dylib,libc++.dylib。

#import "wxapi.h"

#import "wxapiobject.h"

-(void) changescene:(nsinteger )scene

-(void) onresp:(baseresp*)resp

if([resp iskindofclass:[payresp class]])

}uialertview *alert = [[uialertview alloc] initwithtitle:strtitle message:strmsg delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil];

[alert show];

} 5、

調起支付介面:

return;

}nsmutabledictionary * params = [nsmutabledictionary dictionary];

params[@"similar_id"] = @"15c0992d0db44bdd9170e02a98aaf9c5";

nsstring * stamp = [json objectforkey:@"timestamp"];

payreq* req = [[payreq alloc] init];

req.partnerid = [json objectforkey:@"partnerid"];

req.prepayid = [json objectforkey:@"prepayid"];

req.noncestr = [json objectforkey:@"noncestr"];

req.timestamp = stamp.intvalue;

req.package = [json objectforkey:@"package"];

req.sign = [json objectforkey:@"sign"];

[wxapi sendreq:req];

} failure:^(nserror *error) ];if(

self

.weixindic

==nil

|| ![[

self

.weixindic

objectforkey

:@"status"

]isequaltostring

:@"success"

])else //

客戶端提示資訊

- (void

)alert:(

nsstring

*)title msg:(

nsstring

*)msg

可參考:

服務端參考:

iOS 微信支付

當然如果是在xcode7及以上版本,還需要進行下列配置,不然會編譯不通過 解析服務端返回json資料 nserror error 載入乙個nsurl物件 nsurlrequest request nsurlrequest requestwithurl nsurl urlwithstring str ...

ios微信支付

1.需要提供公司資質或者營業執照,個人無法申請。4.新增依賴庫 systemconfiguration.framework libz.dylib libsqlite3.dylib libc dylib coretelephony.framework coregraphics.framework 5....

iOS微信支付

1.匯入sdk檔案 2.匯入相關的系統庫及檔案。不匯入會報錯。3.配置info.plist 或者這樣修改 b.白名單 c.安全配置支援http 當然這部分的配置,也可以通過修改xml來實現。4.修改bitcode。修改 匯入 import wxapimanager.h 2 wxb4ba3c02aa4...