-
Notifications
You must be signed in to change notification settings - Fork 918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App crash randomly when receive ERROR: null #352
Comments
Too much unclear. Please figure out the details in order to help. |
I am using version 1.2.4 and Ionic framework. The error occurs only on IOS when I switch to the map view, with following code function initialize(div, coords, zoom) {
if (!coords) {
coords = $rootScope.currentLocation;
}
try {
center = new plugin.google.maps.LatLng(coords.latitude, coords.longitude);
} catch (e) {
console.log("Plugin is not available!");
return
}
if (!center) {
throw new Exception("Map cannot init without a center!");
}
var mapDiv = document.getElementById(div);
// Initialize the map plugin
map = plugin.google.maps.Map.getMap(mapDiv);
console.log("map initialized");
map.setOptions({
'controls': {
'compass': true,
'indoorPicker': true,
'myLocationButton': true,
'zoom': false
},
'gestures': {
'scroll': true,
'tilt': true,
'rotate': true
},
'camera': {
'latLng': center,
'zoom': (zoom || 15)
}
});
console.log("...........has map?")
if (map) {
map.moveCamera({
'target': center,
'zoom': (zoom || 15)
});
map.setClickable(true);
map.clear();
}
return map;
} |
After the map is setup, I am looping through array of markers and call this function every time. Could this be the problem if I have over 300 markers? function addMarker(latLng, title, icon, _callback) {
markerOptions = {
'position': latLng
}
if (title) {
markerOptions['title'] = title;
}
if (icon) {
markerOptions['icon'] = icon
}
// 'icon': 'www/img/icon-yellow.png'
map.addMarker(markerOptions, function(marker) {
if (_callback) {
_callback(marker);
}
if (icon) {
marker.setIcon({
'url': icon
});
}
});
} |
This is the loop angular.forEach($scope.array, function(item) {
if (item.coords) {
var position = new plugin.google.maps.LatLng(item.coords.latitude, item.coords.longitude);
mapService.addMarker(
position,
item.name,
null,
function(marker) {
marker.addEventListener(plugin.google.maps.event.INFO_CLICK, function() {
});
});
}
}); |
At least, you should wait function initialize(div, coords, zoom, callback) {
var mapDiv = document.getElementById(div);
// Initialize the map plugin
map = plugin.google.maps.Map.getMap(mapDiv, {
'controls': {
'compass': true,
'indoorPicker': true,
'myLocationButton': true,
'zoom': false
},
'gestures': {
'scroll': true,
'tilt': true,
'rotate': true
},
'camera': {
'latLng': center,
'zoom': (zoom || 15)
}
});
map.on(plugin.google.maps.event.MAP_READY, function() {
console.log("map initialized");
console.log("...........has map?")
if (map) {
map.moveCamera({
'target': center,
'zoom': (zoom || 15)
});
map.setClickable(true);
map.clear();
}
callback(map);
});
} |
Hi there,
Any idea?
|
Error null is Cordova bug. It's.not related. Please show me the actual error log. |
There is no other error log at all, it crash all by chance when I switch betwee map views, maybe I can put something together in Github. |
Could you send me your apk file to my e-mail address directly? |
Do you mean Achieve IPA file? Because it only happens to IOS version. Just confirm the email address: wf9a5m75@gmail.com, will send it to you by today. I have donated some money for your effort. Thanks |
Oops, you are developing on iOS. Yes, send me your IPA file. |
You can't transfer an IPA archive without the hassle of getting Masashi's UDID. After this, you need to register his UDID under developer.apple.com -> iOS -> Profiles/Certificates -> "Devices" and refetch the new provisioning profiles inside of Xcode. (Deselect team and reselect again). Choose Project -> Clean -> Project -> archive. If you choose TestFlight, export as Ad-Hoc development, if not, just as development. Just after this steps you can share an IPA file. Or use the Testflightapp but thats the same problem (just the install is a bit easier, works without iTunes when you rely on TestFlightApp) |
HA! |
Ah, yeah. I forgot about that. Thank you for point out. I will reply my UUID when @jianbo send me your IPA file. |
Bet a 100 bucks.... #337
When your url is a remote path, I'm sure this is the reason why your app crash.. |
No man, my markers are loaded from array.
|
And where are your marker images? Inside your www folder? Or on your server? |
No, I am using the default marker, no custom icon at all. |
OK - so wrong alarm. Cause this is my problem. I could load 1000 markers without any problem, as long as I used the default marker. With remote marker images, my app crashed. |
I will send the IPA later when I got back, but is this the right thing to do? I am using Ionic, so when left a map view, I had to clear the map, and when you arrive at another map view, I am re-initialize the newmap view. this is what I do when left a view.
|
Actually it should be enough just to call |
Im unable to reproduce the problem after reduce the marker to 40, and only able to reproduce once when there is 80 markers. |
I'm not sure it will solve the crash problem, but I found the reason for the message "ERROR:null" printed out at console. in
The |
You're right @xuzongque, I think this is a copy & paste error. I guess this should be removed or wrapped around some if-else-statement @wf9a5m75 |
Thank you @xuzongque |
I am using Ionic framework, my map view crash randomly with following errors, even home key doesn't work, had to wait for about a minute still it quit itself .
2015-01-10 23:00:31.270 App[1123:60b] ERROR: null
2015-01-10 23:00:31.271 App[1123:60b] ERROR: null
2015-01-10 23:00:31.271 App[1123:60b] ERROR: null
The text was updated successfully, but these errors were encountered: