Authored by Justin R. Miller

Merge branch 'develop' into release

@@ -58,10 +58,6 @@ @@ -58,10 +58,6 @@
58 58
59 - (id)initWithReferenceURL:(NSURL *)referenceURL; // Designated initializer. Point to either a remote TileJSON spec or a local TileJSON or property list. 59 - (id)initWithReferenceURL:(NSURL *)referenceURL; // Designated initializer. Point to either a remote TileJSON spec or a local TileJSON or property list.
60 60
61 -//  
62 -// You may also use just `init` to get MapBox Streets by default.  
63 -//  
64 -  
65 - (id)initWithTileJSON:(NSString *)tileJSON; // Initialize source with TileJSON. 61 - (id)initWithTileJSON:(NSString *)tileJSON; // Initialize source with TileJSON.
66 - (id)initWithInfo:(NSDictionary *)info; // Initialize source with properly list (deprecated). 62 - (id)initWithInfo:(NSDictionary *)info; // Initialize source with properly list (deprecated).
67 63
@@ -45,11 +45,6 @@ @@ -45,11 +45,6 @@
45 45
46 @synthesize infoDictionary; 46 @synthesize infoDictionary;
47 47
48 -- (id)init  
49 -{  
50 - return [self initWithReferenceURL:[NSURL URLWithString:@"http://api.tiles.mapbox.com/v2/mapbox.mapbox-streets.json"]];  
51 -}  
52 -  
53 - (id)initWithTileJSON:(NSString *)tileJSON 48 - (id)initWithTileJSON:(NSString *)tileJSON
54 { 49 {
55 if (self = [super init]) 50 if (self = [super init])
@@ -80,6 +75,12 @@ @@ -80,6 +75,12 @@
80 { 75 {
81 id dataObject; 76 id dataObject;
82 77
  78 + if ([[referenceURL pathExtension] isEqualToString:@"jsonp"])
  79 + referenceURL = [NSURL URLWithString:[[referenceURL absoluteString] stringByReplacingOccurrencesOfString:@".jsonp"
  80 + withString:@".json"
  81 + options:NSAnchoredSearch & NSBackwardsSearch
  82 + range:NSMakeRange(0, [[referenceURL absoluteString] length])]];
  83 +
83 if ((dataObject = [NSString stringWithContentsOfURL:referenceURL encoding:NSUTF8StringEncoding error:nil]) && dataObject) 84 if ((dataObject = [NSString stringWithContentsOfURL:referenceURL encoding:NSUTF8StringEncoding error:nil]) && dataObject)
84 return [self initWithTileJSON:dataObject]; 85 return [self initWithTileJSON:dataObject];
85 86