objective-c - After the application jumps to WeChat and returns, the values ​​of all member properties under the view controller become nil
给我你的怀抱
给我你的怀抱 2017-05-02 09:32:23
0
0
502

webApp, there is a UIWebView.UIWebView in the view controller to render web pages.

Now to make WeChat payment, js calls oc, then calls up the WeChat APP, and then returns to your own APP after the payment is successful or canceled. You want to pass the payment result to the front end through oc calling js.

However, at this time, it was discovered that the values ​​​​of all member properties under the view controller are nil (printed with NSLog) and the webView is also nil. [self.webView stringByEvaluatingJavaScriptFromString:@"pay()"] Naturally, such a call has no results.

For example, the view controller has a member attribute called url. Before jumping to WeChat App, first assign the value to 123, self.url = @"123"
, print the value of url NSLog(@"%@",self.url)At this time, the value is 123, jump to WeChat App, then come back and print the value of the url in the WeChat payment callback function NSLog(@"%@",self.url) which is nil at this time

给我你的怀抱
给我你的怀抱

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template