GoogleNavigation Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSURLTileLayer
GMSURLTileProvider
fetches tiles based on the URLs returned from a GMSTileURLConstructor
. For
example:
GMSTileURLConstructor constructor = ^(NSUInteger x, NSUInteger y, NSUInteger zoom) {
NSString *URLStr =
[NSString stringWithFormat:@"https://example.com/%d/%d/%d.png", x, y, zoom];
return [NSURL URLWithString:URLStr];
};
GMSTileLayer *layer =
[GMSURLTileLayer tileLayerWithURLConstructor:constructor];
layer.userAgent = @"SDK user agent";
layer.map = map;
GMSURLTileProvider
may not be subclassed and should only be created via its convenience
constructor.
-
Convenience constructor. constructor
must be non-nil.
Declaration
Objective-C
+ (nonnull instancetype)tileLayerWithURLConstructor:
(nonnull GMSTileURLConstructor)constructor;
-
Specify the user agent to describe your application. If this is nil (the default), the default
iOS user agent is used for HTTP requests.
Declaration
Swift
var userAgent: String? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSString *userAgent;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMSURLTileLayer\u003c/code\u003e fetches map tiles using URLs provided by a \u003ccode\u003eGMSTileURLConstructor\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize the user agent for HTTP requests made by the tile layer.\u003c/p\u003e\n"],["\u003cp\u003eIt's easily initialized using a convenience constructor that takes a \u003ccode\u003eGMSTileURLConstructor\u003c/code\u003e to define how tile URLs are generated.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGMSURLTileProvider\u003c/code\u003e cannot be subclassed and should only be created using its designated constructor.\u003c/p\u003e\n"]]],[],null,["# GoogleNavigation Framework Reference\n\nGMSURLTileLayer\n===============\n\n @interface GMSURLTileLayer : ../Classes/GMSTileLayer.html\n\n`GMSURLTileProvider` fetches tiles based on the URLs returned from a [GMSTileURLConstructor](../Type-Definitions/GMSTileURLConstructor.html). For\nexample: \n\n```\n GMSTileURLConstructor constructor = ^(NSUInteger x, NSUInteger y, NSUInteger zoom) {\n NSString *URLStr =\n [NSString stringWithFormat:@\"https://example.com/%d/%d/%d.png\", x, y, zoom];\n return [NSURL URLWithString:URLStr];\n };\n GMSTileLayer *layer =\n [GMSURLTileLayer tileLayerWithURLConstructor:constructor];\n layer.userAgent = @\"SDK user agent\";\n layer.map = map;\n \n```\n\n\u003cbr /\u003e\n\n`GMSURLTileProvider` may not be subclassed and should only be created via its convenience\nconstructor.\n- `\n ``\n ``\n `\n\n ### [+tileLayerWithURLConstructor:](#/c:objc(cs)GMSURLTileLayer(cm)tileLayerWithURLConstructor:)\n\n `\n ` \n Convenience constructor. `constructor` must be non-nil. \n\n #### Declaration\n\n Swift \n\n convenience init(urlConstructor constructor: @escaping ../Type-Definitions/GMSTileURLConstructor.html)\n\n Objective-C \n\n + (nonnull instancetype)tileLayerWithURLConstructor:\n (nonnull ../Type-Definitions/GMSTileURLConstructor.html)constructor;\n\n- `\n ``\n ``\n `\n\n ### [userAgent](#/c:objc(cs)GMSURLTileLayer(py)userAgent)\n\n `\n ` \n Specify the user agent to describe your application. If this is nil (the default), the default\n iOS user agent is used for HTTP requests. \n\n #### Declaration\n\n Swift \n\n var userAgent: String? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSString *userAgent;"]]