Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13557] iOS: Ti.Map.View.removeAnnotations doesn't work + solution.

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterSergey Nosenko
AssigneeUnknown
Created2013-04-15T10:05:01.000+0000
Updated2018-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)

Comments

No comments

JSON Source