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
Post a Comment