Note that there are some explanatory texts on larger screens.

plurals
  1. POObjective-C error: No visible @interface declares the selector
    primarykey
    data
    text
    <p>I have next to no knowledge of Objective-C, but I'm using Cordova (PhoneGap) to create a web app and needed to manipulate the headers sent by their InAppBrowser plugin.</p> <p>I have managed to get custom headers to send with the request, I changed the NSURLRequest to a NSMutableURLRequest and then set a custom header like this:</p> <pre><code>NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url]; [request setValue:@"test" forHTTPHeaderField:@"Accept-Encoding"]; </code></pre> <p>My next problem was passing the headers from the javascript. I added an additional option to the parameters. The parameters need to be passed along between several functions (or methods?) before they get to the place where I can manipulate the headers. I've managed to pass them through several functions, and NSLog is still showing me the correct value that I sent from my javascript, but I've fallen at the final hurdle. I can't pass an additional parameter to my final function!</p> <p>I have this bit of code here:</p> <pre><code>[self.inAppBrowserViewController navigateTo:url withHeaders:headers ]; </code></pre> <p>Which calls the navigateTo function that is defined like this:</p> <pre><code>- (void)navigateTo:(NSURL*)url withHeaders:(NSString*)headers { NSMutableURLRequest* request = [NSMutableURLRequest requestWithURL:url]; [request setValue:@"test" forHTTPHeaderField:@"Accept-Encoding"]; if (_userAgentLockToken != 0) { [self.webView loadRequest:request]; } else { [CDVUserAgentUtil acquireLock:^(NSInteger lockToken) { _userAgentLockToken = lockToken; [CDVUserAgentUtil setUserAgent:_userAgent lockToken:lockToken]; [self.webView loadRequest:request]; }]; } } </code></pre> <p>The problem I have is that the line that calls navigateTo is giving me the error: "CordovaLib/Classes/CDVInAppBrowser.m:149:6: No visible @interface for 'CDVInAppBrowserViewController' declares the selector 'navigateTo:withHeaders:'"</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload