Ios 为什么MKTileOverlay initWithURLTemplate:template返回nil?

Ios 为什么MKTileOverlay initWithURLTemplate:template返回nil?,ios,mapkit,mktileoverlay,Ios,Mapkit,Mktileoverlay,我有如下代码: - (void)viewDidLoad { [super viewDidLoad]; NSString* template = [NSString stringWithFormat: @"http://my-map-server.com/?mode=tile&tilemode=gmap&tile={x}+{y}+{z}"] ; MKTileOverlay * overlay = [[MKTileOverlay alloc] initWithURLTemplat

我有如下代码:

- (void)viewDidLoad
{
[super viewDidLoad];

NSString* template = [NSString stringWithFormat: @"http://my-map-server.com/?mode=tile&tilemode=gmap&tile={x}+{y}+{z}"] ;

MKTileOverlay * overlay = [[MKTileOverlay alloc] initWithURLTemplate:template]; //returns nil
overlay.canReplaceMapContent = NO;

[mainMap addOverlay:overlay1 level:MKOverlayLevelAboveLabels];

}
为什么[[MKTileOverlay alloc]initWithURLTemplate:template]返回nil值?我找不到任何合理的解决办法。类似的代码在我的另一个项目中工作

此模板字符串应包含{x}、{y}、{z}和{scale}占位符字符串,以便于创建URL以请求适当的互动程序

如果将{scale}添加到模板中,会得到相同的结果吗