ios - Memory leak in UIWebview when loading data content with url (WebCore::CachedResource::unregisterHandle) -


i have problem uiwebview. when loading data content url, application has crashed. occurs time in month. tired it, couldn't reappear it. occurs on client's device. please me. application run on ios7.1

  1. exception type: exc_bad_access (sigsegv)
  2. exception subtype: kern_invalid_address"
  3. thread 2 name: webthread
  4. thread 2 crashed: 0 webcore 0x38322b02 webcore::cachedresource::unregisterhandle(webcore::cachedresourcehandlebase*) + 110 1 webcore 0x38322a8a webcore::cachedresourcehandlebase::~cachedresourcehandlebase() + 14 2 webcore 0x384b77fe webcore::memorycache::prunedeadresourcestosize(unsigned int) + 278 3 webcore 0x38396aee webcore::memorycache::prune() + 94"

the following our source code.

if ([defaults boolforkey:@"cacheenabled"]) {     [[nsurlcache sharedurlcache] setmemorycapacity:[defaults integerforkey:@"cachesize"]]; } else {     [[nsurlcache sharedurlcache] removeallcachedresponses];     [[nsurlcache sharedurlcache] setmemorycapacity:0]; }  nsurl *url = [nsurl urlwithstring:[defaults objectforkey:@"connectionurl"]]; nsurlrequest *request = [nsurlrequest requestwithurl:url]; nsoperationqueue *queue = [[nsoperationqueue alloc] init]; [nsurlconnection sendasynchronousrequest:request queue:queue completionhandler:^(nsurlresponse *response, nsdata *data, nserror *error)  {      if ([data length] > 0 && error == nil) [self.webview loadrequest:request];      else if (error != nil) nslog(@"error: %@", error);  }]; 

in dealloc method :

[_webview setdelegate:nil]; [_webview stoploading]; 

thanks advanced !

i think main issue loading request webview not in main thread.

nsoperationqueue *queue = [[nsoperationqueue alloc] init]; [nsurlconnection sendasynchronousrequest:request queue:queue completionhandler:^(nsurlresponse *response, nsdata *data, nserror *error)  {      if ([data length] > 0 && error == nil) [self.webview loadrequest:request];      else if (error != nil) nslog(@"error: %@", error);  }]; 

1/ should change param queue [nsoperationqueue mainqueue]

2/ other bugs ( not relate crash): should check response.statuscode == 200 before load webview :d


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -