[TIMOB-13557] iOS: Ti.Map.View.removeAnnotations doesn't work + solution.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | n/a |
Reporter | Sergey Nosenko |
Assignee | Unknown |
Created | 2013-04-15T10:05:01.000+0000 |
Updated | 2018-02-28T20:03:36.000+0000 |
Description
Q&A link to issue and solution.
http://developer.appcelerator.com/question/146932/how-to-delete-an-array-of-annotations#answer-260727
In following code ENSURE_TYPE makes array with one element which is array of annotations.
-(void)removeAnnotations:(id)arg
{
ENSURE_TYPE(arg,NSArray)
for (id ann in arg) {
if ([ann isKindOfClass:[TiMapAnnotationProxy class]]) {
[self forgetProxy:ann];
}
}
if ([self viewAttached]) {
TiThreadPerformOnMainThread(^{
[(TiMapView*)[self view] removeAnnotations:arg];
}, NO);
}
else {
for (id annotation in arg) {
[self removeAnnotation:annotation];
}
}
}
to resolve it we must replace
ENSURE_TYPE(arg,NSArray)
with more correct
ENSURE_SINGLE_ARG(arg,NSArray)
No comments