我有以下内容NSSURL
:
myURL - myPlatform://sdk/functionName?key1=value1&key2=value2
如何获取 URL 组件?
NSString *myPlatform = [myURL...?
NSString *functionName = [myURL...?
NSString *key1 = [myURL...?
NSString *value1 = [myURL...?
NSString *key2 = [myURL...?
NSString *value2 = [myURL...?
我有这个代码:
- (BOOL)webView:(UIWebView *)webView2 shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url= [request URL];
Log(@"url: %@", url);
NSArray *components = [url pathComponents];
for (NSString *c in components)
Log(@"URL component: %@", c);
}
这在日志中:url:
网址:myPlatform://sdk/functionName?key1=value1&key2=value2
零件: /
组件:函数名
提前致谢