Discussion Forums  >  Maps, Device Location, Tracking

Replies: 8    Views: 127

nickrick32
Apple Fan
Profile
Posts: 111
Reg: Feb 28, 2011
location unknow...
1,110
05/30/13 11:35 AM (11 years ago)

App Crash after tap in map location plugin

App Crash after tap in map location plugin Hi, I have app with 60 different maps which get data from external php script (made by David) and now I have a problem that after while app crash when I tap on some pin on the map. I have screen shots of the error here: https://dl.dropboxusercontent.com/u/32338988/Map%20Xcode%20Error.zip On every map display max 10 locations and after tap on location redirect on php script with details of the location. I tested and after about 30 maps when I tap on item details app crash (when I use iPhone) and in simulator I have a screen shots of the error). In the log of Xcode there is no error just this: 2013-05-30 17:47:00.952 mymap[29483:907] BT_screen_map: downloadFileStarted: starting download... 2013-05-30 17:47:00.957 mymap[29483:907] BT_screen_map: showProgress 2013-05-30 17:47:01.258 mymap[29483:907] BT_screen_map: viewDidAppear in BT_viewController BASE CLASS 2013-05-30 17:47:01.262 mymap[29483:907] BT_screen_map: hideProgress 2013-05-30 17:47:01.925 mymap[29483:907] BT_fileManager: saveTextFileToCacheWithEncoding: screenData_DCCC5BB6D27D48AB108D867.txt encodingFlag: -1 2013-05-30 17:47:01.969 mymap[29483:907] BT_screen_map: downloadFileCompleted: Success 2013-05-30 17:47:01.970 mymap[29483:907] BT_screen_map: hideProgress 2013-05-30 17:47:01.972 mymap[29483:907] BT_fileManager: File does exist in cached directory: screenData_DCCC5BB6D27D48AB108D867.txt 2013-05-30 17:47:01.973 mymap[29483:907] BT_screen_map: parsing downloaded screen data. 2013-05-30 17:47:01.974 mymap[29483:907] BT_fileManager: readTextFileFromCacheWithEncoding: screenData_DCCC5BB6D27D48AB108D867.txt encoding: -1 2013-05-30 17:47:01.977 mymap[29483:907] BT_screen_map: parseScreenData 2013-05-30 17:47:01.989 mymap[29483:907] BT_screen_map: layoutScreen 2013-05-30 17:47:03.066 mymap[29483:907] BT_screen_map: mapView:centerMap 2013-05-30 17:47:03.661 mymap[29483:907] BT_screen_map: showProgress 2013-05-30 17:47:03.663 mymap[29483:907] BT_viewUtilities: getProgressView 2013-05-30 17:47:03.726 mymap[29483:907] BT_screen_map: hideProgress 2013-05-30 17:47:03.847 mymap[29483:907] BT_screen_map: showProgress 2013-05-30 17:47:03.849 mymap[29483:907] BT_viewUtilities: getProgressView 2013-05-30 17:47:03.878 mymap[29483:907] BT_screen_map: hideProgress 2013-05-30 17:47:04.157 mymap[29483:907] BT_screen_map: showProgress 2013-05-30 17:47:04.164 mymap[29483:907] BT_viewUtilities: getProgressView 2013-05-30 17:47:04.195 mymap[29483:907] BT_screen_map: hideProgress and after that it crash. Any solution for that? Thank you
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
05/30/13 06:48 PM (11 years ago)
keep u posted!
 
nickrick32
Apple Fan
Profile
Posts: 111
Reg: Feb 28, 2011
location unknow...
1,110
like
05/30/13 11:50 PM (11 years ago)
thank you
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
05/31/13 12:41 AM (11 years ago)
Strange. I've not heard of this before after thousands and thousands of map screens. Not sure what to think. I do know that ALL, and I mean ALL bad_access crashes are related to memory management. ARC (automatic reference counting), retaining, and releasing memory objects is a complicated subject and for sure not something that's easily explained in a forum post. But...that's what's going on here. iOS is trying to reference an object in memory that has already been released and is no longer available. This of course begs the next question - what's getting released when it should not be? Memory issues and debugging is a giant pain so no easy advice there either. I guess at this point you'll need to try to isolate what object is being released and then referenced again, which is what causes the app to crash. The screenshots validate this idea but don't do much in way of figuring out what's happening. I think I would start by commenting out the dealloc method in the BT_item.m class. The entire method, get rid of it. Comment out everything inside the dealloc method in BT_item.m so nothing is released there. Give it a go, if it doesn't change anything, uncomment (put it back the way it was) and continue looking. You're looking for a "release" call that's premature. Not sure how else to describe this strange behavior. I'm happy to look at the project but would need it in it's entirety before being able to debug anything.
 
nickrick32
Apple Fan
Profile
Posts: 111
Reg: Feb 28, 2011
location unknow...
1,110
like
05/31/13 01:41 AM (11 years ago)
Hi David, thank you for support I will send you app and all info's via email.
 
nickrick32
Apple Fan
Profile
Posts: 111
Reg: Feb 28, 2011
location unknow...
1,110
like
06/03/13 03:58 AM (11 years ago)
Hi David, I sent you email few days ago with project files did you get it?
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
06/03/13 10:25 PM (11 years ago)
Hi Nick, I got your email and had a look at your app. A few things...firstly...GORGEOUS APP!!!! Well done my friend, this thing is super sweet on the eyes. Technical stuff... --"I have app with 60 different maps which get data from external php script (made by David)." Correction. I didn't make any scripts for your app. I sent you some samples, you made what you're using. There is a difference. Your script is working fine and is not the issue. --The email you sent contains several different questions. 1) Why doesn't your .php script pull the locations as you expect. I can't quite understand your question and I can't do custom .php scripting for you. You'll need to figure this out on your own. 2) The memory issue you mentioned in the title of this post. App crashes after 20 or so tap, see * below. 3) Search: "is there a way to search all data which I provide via php" The search plugin you're using searches for screens in your app with nickname's that contain the entered term. It does not search a backend system. If you need to search your backend database you'll need to roll your own solution. Again, I can't do custom .php work for you. I provided you tons of samples and you'll need to work from those or hire somebody to help you? They are a good starting place if you don't know .php well enough to spin your own backend search. *On to the memory / crashing part. Here's how your app is working. Tap a menu item, it loads a map > tap a callout bubble on the map, it loads a Custom URL plugin > The URL loading in the Custom URL plugin looks like this: http://missearthschweiz.ch/__ios/cti/railway/list_loc_details.php?itemId=58 (9786 Km)&address= Kolodvorska 5, Mursko Sredisce&title=Railway Station&website=www.hznet.hr&phone=00385 40 543457&[email protected]&latitude=46.50818&longitude=16.446&image=train-580x390.jpg&time= This is what's crashing your app. The Custom URL plugin is using a UIWebView to display this HTML content. The HTML in the UIWebView is loading a dynamically created Static Map from Google Maps. Have a look at the HTML source for that page (use a regular browser then View Source) and you'll see the img tag pointing to google's static map api. This is generally OK but I'm wondering if it's too much to ask the built in UIWebView to load this type of content over and over again? I'm asking because it's famous for not releasing memory that's consumed "inside" the UIWebView. Example: If you loaded 100 pdf's in the UIWebView it would also crash. I'm not certain the dynamic map tile is the issue but it sure feels like the same problem with UIWebView memory management. There is a work around (for issues where the UIWebView won't release it's memory) but it's complicated. You could try... a) Make a UIWebView object in the app's delegate file. This will make it "global" and available anywhere in your app. b) Modify the Custom URL plugin so it does NOT create a new UIWebView each and every time it loads but instead just uses the one you created ONCE in the app's delegate. This way you're no re-creating UIWebVIew's over and over but just changing the URL in the one that already exists. Hope this helps.
 
nickrick32
Apple Fan
Profile
Posts: 111
Reg: Feb 28, 2011
location unknow...
1,110
like
06/04/13 08:52 AM (11 years ago)
Hi David, I'm glad that you like the app. :) First part I will find solution for search if not I will leave as it is. Thanks for that. Memory/crashing part I have test without Google Maps in HTML content and it is the same problem and even crash earlier than before. Strange thing is that I try on iPhone 5.0 simulator and everything works fine (with and without Google maps in HTML) but on iPhone simulator 6.0 and 6.1 crash very often. I'm not sure if I can do this " a) Make a UIWebView object in the app's delegate file. This will make it "global" and available anywhere in your app. b) Modify the Custom URL plugin so it does NOT create a new UIWebView each and every time it loads but instead just uses the one you created ONCE in the app's delegate. This way you're no re-creating UIWebVIew's over and over but just changing the URL in the one that already exists. " Is there a way to use HTML Pro plugin to use instead of detailpage.php which I use to display HTML data with Google Maps on it? ( In that case all images can be at device and it can load only data (address,...) and Google Maps from web? Thank you again for your effort.
 
nickrick32
Apple Fan
Profile
Posts: 111
Reg: Feb 28, 2011
location unknow...
1,110
like
06/06/13 09:28 AM (11 years ago)
Hi David, I have made another test. I just open map with 10 pins and didn't tap for info and open 16 maps (2-5 seconds for each) and on 17 map app crash. In log file I get 5 "Received memory warning." before crash. In this case app didn't use Custom URL to get data just open the map with 10 pins. I'm not sure in which direction to go to solve this issue. App is 99% done but because of this crashes I can't publish the app and with this problem I struggle 10 days. Any advice? Thank you
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.