The code for opening URLs from an iPhone app is relatively simple:
NSURL *url = [NSURL URLWithString:@"http://pulkitsinghal.blogspot.com"];
[[UIApplication sharedApplication] openURL:url];
Yet the 1st time I tried to use it, I kept running into the SIGABRT exception.
Ofcourse I blame the code right? Yup!
But after many searches on Google yielded no clues at all, I went back to the stack trace:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[IconDetailsViewController gotoAuthorWebSite:]: unrecognized selector sent to instance 0x4e619b0'
For the life of me, I couldn't figure out why it was claiming that the method/selector gotoAuthorWebSite was not present when I could see it in my code and the webpage was launching as well! How could it do what it was supposed to do and still claim that the code that was supposed to do the work didn't exist?
Turns out that at some point of time there was a case-sensitive discrepancy between the signatures in my .h and .m files!
- (IBAction) gotoAuthorWebSite:(UIButton*)sender;
- (IBAction) gotoAuthorWebsite:(UIButton*)sender{...}
And I happened to have resolved this inconsistency but only after I had already wired up both these methods to the UIButton component in the NIB file! So the problem was that the non-existent method (with the incorrect casing) had not been auto-removed as the following picture shows:After manually deleting this incorrect mapping from the NIB file, everything was peachy!
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment