Skip to content

Commit

Permalink
[TIMOB-17659] iOS: Fixed exception when setting "centerCoordinate" on…
Browse files Browse the repository at this point in the history
… camera
  • Loading branch information
jonalter committed Sep 30, 2014
1 parent 470f1e9 commit 1e5fec5
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
49 changes: 36 additions & 13 deletions ios/Classes/TiMapCameraProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,46 +65,69 @@ -(MKMapCamera*)camera
-(void)setAltitude:(id)value
{
ENSURE_SINGLE_ARG(value, NSNumber);
[self camera].altitude = [TiUtils doubleValue:value];
TiThreadPerformOnMainThread(^{
[self camera].altitude = [TiUtils doubleValue:value];
}, NO);
}
-(NSNumber*)altitude
{
return [NSNumber numberWithDouble:[self camera].altitude];
__block NSNumber *result;
TiThreadPerformOnMainThread(^{
result = [[NSNumber numberWithDouble:[self camera].altitude] retain];
}, YES);
return [result autorelease];
}

-(void)setCenterCoordinate:(id)args
{
ENSURE_SINGLE_ARG(args, NSDictionary);
[self camera].centerCoordinate = [self locationCoordinatesFromDict:args];
TiThreadPerformOnMainThread(^{
[self camera].centerCoordinate = [self locationCoordinatesFromDict:args];
}, NO);
}
-(NSDictionary*)centerCoordinate
{
CLLocationCoordinate2D centerCord = [self camera].centerCoordinate;
NSDictionary *result = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithDouble:centerCord.latitude], @"latitude",
[NSNumber numberWithDouble:centerCord.longitude], @"longitude",
nil];
return result;
__block NSDictionary *result;
TiThreadPerformOnMainThread(^{
CLLocationCoordinate2D centerCord = [self camera].centerCoordinate;
result = [[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithDouble:centerCord.latitude], @"latitude",
[NSNumber numberWithDouble:centerCord.longitude], @"longitude",
nil] retain];
}, YES);
return [result autorelease];
}

-(void)setHeading:(id)value
{
ENSURE_SINGLE_ARG(value, NSNumber);
[self camera].heading = [TiUtils doubleValue:value];
TiThreadPerformOnMainThread(^{
[self camera].heading = [TiUtils doubleValue:value];
}, NO);
}
-(NSNumber *)heading
{
return [NSNumber numberWithDouble:[self camera].heading];
__block NSNumber *result;
TiThreadPerformOnMainThread(^{
result = [[NSNumber numberWithDouble:[self camera].heading] retain];
}, YES);
return [result autorelease];
}

-(void)setPitch:(id)value
{
ENSURE_SINGLE_ARG(value, NSNumber);
[self camera].pitch = [TiUtils doubleValue:value];
TiThreadPerformOnMainThread(^{
[self camera].pitch = [TiUtils doubleValue:value];
}, NO);
}
-(NSNumber *)pitch
{
return [NSNumber numberWithDouble:[self camera].pitch];
__block NSNumber *result;
TiThreadPerformOnMainThread(^{
result = [[NSNumber numberWithDouble:[self camera].pitch] retain];
}, YES);
return [result autorelease];
}

# pragma mark Utils
Expand Down
2 changes: 2 additions & 0 deletions ios/documentation/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Change Log
<pre>
v2.0.5 Fixed exception when setting "centerCoordinate" on camera [TIMOB-17659]

v2.0.4 Fixed "userLocation" permissions for iOS 8 [TIMOB-17665]
Bumping minsdk to 3.4.0 [TIMODOPEN-437]

Expand Down
2 changes: 1 addition & 1 deletion ios/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 2.0.4
version: 2.0.5
apiversion: 2
description: External version of Map module
author: Jeff Haynie & Jon Alter
Expand Down
Binary file removed ios/ti.map-iphone-2.0.4.zip
Binary file not shown.
Binary file added ios/ti.map-iphone-2.0.5.zip
Binary file not shown.

0 comments on commit 1e5fec5

Please sign in to comment.