Warning: The format indicates the type is "long", but the argument is of the type "UIWebViewNavigationType" (also known as "enum UIWebViewNavigationType")

I wonder if anyone can help me with this error warning I get in Xcode. I think this has to do with 32-bit 64-bit. I would like the code to work on both 32 and 64 bit. Corresponding code section:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSLog(@"expected:%ld, got:%ld", (long)UIWebViewNavigationTypeLinkClicked, navigationType);
    NSLog(@"Main Doc URL:%@", [[request mainDocumentURL] absoluteString]);
    if (navigationType == UIWebViewNavigationTypeLinkClicked) {
        [[UIApplication sharedApplication] openURL:[request mainDocumentURL]];
        return NO;

many thanks

+4
source share
1 answer

UIWebViewNavigationType defined as

typedef NS_ENUM(NSInteger, UIWebViewNavigationType) {
    // ...
};

and NSInteger- this is intfor 32-bit and long64-bit platforms. Therefore you must distinguish the meaninglong

NSLog(@"expected:%ld, got:%ld", (long)UIWebViewNavigationTypeLinkClicked,
                                (long)navigationType);

( ) .

+13

Source: https://habr.com/ru/post/1538628/


All Articles