I’m trying to implement a sort of Google street view on a UIWebView. I have a map with annotations, and when you tap on the disclosure for the annotation a new scene is pushed.
Inside that scene is just my UIWebView and a tool bar with a close button.
I’m loading a local file which renders the Google Maps street view via the JavaScript API. Here is the source code.
I then evaluate some JS to reposition the panoramic view to be the location of the user.
My view gets memory warnings very quickly as you scroll in a 360 view. I’m not doing a lot of tapping, just a panoramic view of the location I’m in.
Sometimes the view dies, and other occasions the app crashes all together.
2011-01-31 22:46:20.262 iPadApp[2151:307] Received memory warning. Level=1
2011-01-31 22:46:35.551 iPadApp[2151:307] Received memory warning. Level=1
2011-01-31 22:46:50.651 iPadApp[2151:307] Received memory warning. Level=1
It seems to consume a lot of memory when you do the double tap to zoom. I looked at ways to suppress the double tap in the Google options, and by subclassing UIWebView, so that only single taps get through.
Strangely, I can bring up the same file in mobile safari and it handles the memory management fine and doesn’t crash.
It would make my life a whole lot easier if Apple opened up their API so developers could use the street view in MapKit.
Does anyone know how I can achieve what I’m attempting without it crashing all the time? Or is there a better way to achieve a street view in iOS?
If you add the webview on a popover view controller this works, presumably because the view is smaller and smaller images are shown.