let json = try JSONSerialization.jsonObject(with: data, options: []) as! NSDictionary
let request = PayReq()
request.nonceStr = json.object(forKey: "noncestr") as! String
request.package = json.object(forKey: "package") as! String
request.partnerId = json.object(forKey: "partnerid") as! String
request.prepayId = json.object(forKey: "prepayid") as! String
request.timeStamp = UInt32((json.object(forKey: "timestamp") as! NSString).intValue)
request.sign = json.object(forKey: "sign") as! String
WXApi.send(request)
执行到最后一步时就会出现以下情况。
我自己找到问题了,反复仔细阅读开发文档后发现遗漏了这句话:
在你的工程文件中选择 Build Setting,在"Other Linker Flags"中加入"-ObjC -all_load"
填上之后就好了。