objective c - Ipad Error: 'Program received signal EXC_BAD_ACCESS' -


i getting error when deploy ipad. not occur in simulator.

my ipad app has 3 uiwebviews. majority of application written web app, , uses css make more native. links clicked in various web views open in 1 depending on value of request variable "ipadtarget."

- (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype {     nsurl *url = [request url];   //extract value request variable 'ipadtarget' in url string.  nsstring *test = [url query];  int index = [test rangeofstring:@"ipadtarget="].location;   int target = index + 11;  nslog(@"%i", target);  char c = [test characteratindex:target];  nslog(@"%c",c);   if (navigationtype == uiwebviewnavigationtypelinkclicked) {   if (c == '1') {       [viewone loadrequest:request];       return no;   } else if (c == '2') {    [viewtwo loadrequest:request];    return no;   } else if (c == '3') {    [viewthree loadrequest:request];    return no;   }  }    return yes;   [url release];     } 

the above code locates variable "ipadtarget" , extracts value (1 3). why strange error? appreciated.

the line

[url release]; 

is source of trouble. releasing object not own. acquired url through -url method of request, , not contain new, create, or copy not owner. remove line [url release], , re-read memory management guidelines.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -