setAnnotations: Invalid type passed to function/unrecognized selector sent to instance
m1ga opened this issue · comments
Using setAnnotations(array)
fails with different error messages using main-thread or not:
var pois = [];
_.each(items, function(item){
pois.push(Map.createAnnotation({
latitude: parseFloat(item.lat),
longitude: parseFloat(item.long),
title: item.name,
image: pinImage,
catid: item.catid,
subtitle: name,
id: item.id,
centerOffset: cOffset
}));
});
$.mapview.setAnnotations(pois);
with run-on-main-thread=false
[ERROR] Script Error {
[ERROR] column = 41;
[ERROR] line = 19;
[ERROR] message = "Invalid type passed to function";
[ERROR] nativeLocation = "-[TiGooglemapsViewProxy setAnnotations:] (TiGooglemapsViewProxy.m:378)";
[ERROR] nativeReason = "expected: Array, was: TiGooglemapsAnnotationProxy";
[ERROR] stack = "[native code]\n\n";
[ERROR] }
with run-on-main-thread=true
[ERROR] Script Error {
[ERROR] column = 41;
[ERROR] line = 18;
[ERROR] message = "-[TiGooglemapsAnnotationProxy count]: unrecognized selector sent to instance 0x7f99e5c19d20";
[ERROR] stack = "[native code]\n\n";
[ERROR] }
adding them manually with
_.each(pois,function(item){
$.mapview.addAnnotation(item);
})
works fine and the same setAnnotations()
code is working in ti.map
(android,ios)
Looks like you are passing no array but a single annotation, so it will fail.
Closing due to the above reason.