iphone - Open Link in UIWebview not UIShared Application -
i have been having rough time trying open links user clicks in simple web view instead of multitasking , going safari. quite pain users have leave app every time link clicked , know quite simple still having terrible time making happen. here code using still when link clicked opens safari.
if can point me in right direction appreciative! thank you!
- (void) handleurl:(nsurl*)url { [web loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:@"%@"]]]; } - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { nslog(@"expected:%d, got:%d", uiwebviewnavigationtypelinkclicked, navigationtype); if (navigationtype == uiwebviewnavigationtypelinkclicked) { [uiapplication sharedapplication] ; return no; } if (navigationtype == uiwebviewnavigationtypelinkclicked) { [web loadrequest:[nsurlrequest requestwithurl:[nsurl urlwithstring:replytweettext.text]]]; return yes; } }
i'm not sure bit does:
if (navigationtype == uiwebviewnavigationtypelinkclicked) { [uiapplication sharedapplication] ; return no; }
the line [uiapplication sharedapplication];
creates , returns singleton application instance. aren't doing it.
also, both if
statements identical, first ever hit , method returns no
. there no default returned value, bad non-void function. try instead:
- (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { return yes; }
Comments
Post a Comment