0
我有以下段落:使用的NSLog打印navigationType
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType *)navigationType {
NSURL * url = [request URL];
NSRegularExpression* regex = [[NSRegularExpression alloc] initWithPattern:@"loggedout" options:(NSRegularExpressionOptions)NSCaseInsensitiveSearch error:NULL];
NSString *urlString = [url absoluteString];
NSUInteger numberOfMatches = [regex numberOfMatchesInString:urlString options:0 range:NSMakeRange(0, [urlString length])];
[regex release];
if (numberOfMatches > 0) {
// NSLog(@"%@", url);
// NSLog(@"%i", numberOfMatches);
[self.navigationController popViewControllerAnimated:YES];
return NO;
}
if (UIWebViewNavigationTypeLinkClicked == navigationType)
{
[[UIApplication sharedApplication] openURL:url];
return NO;
}
return YES;
}
我想打印用的NSLog的「navigationType」變量,但我無法找到一個格式說明(如:@「%@ 「或@」%d「)與變量兼容或不會導致應用程序崩潰。任何人都可以建議嗎?