My app working with Geojson
file. I use MapBox SDK to add MGLPolyline
to map. But the problem is my file too large, so that the app crash and got the e
First Solution
Maybe your for loop is running infinitely and allocating memory to an array with nil value every time. It is using high amounts of memory, so it gives this error.
Please check by print something in the for loop.
Second Solution
Add this in didReceiveMemoryWarning
:
NSURLCache.sharedURLCache().removeAllCachedResponses()
NSURLCache.sharedURLCache().diskCapacity = 0
NSURLCache.sharedURLCache().memoryCapacity = 0
You can also change the cache policy of the NSURLRequest
:
let day_url = NSURL(string: "http://www.example.com")
let day_url_request = NSURLRequest(URL: day_url,
cachePolicy: NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData,
timeoutInterval: 10.0)
let day_webView = UIWebView()
day_webView.loadRequest(day_url_request)
More information on cache policies here.