将用户位置坐标作为 googleMaps 链接发送到 SMS.app
我想将我的位置坐标作为 Google 地图链接 (http://maps.google.com/?saddr=%1.6f,%1.6f) 作为短信发送,但我就是无法让它工作...如何我应该这样做,以便 GoogleMaps 链接根据我的位置而变化吗?
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
controller.body = @"This is my location http://maps.google.com/?saddr=%1.6f,%1.6f";
NSString *googleMaps = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f", location.latitude, location.longitude];
controller.recipients = [NSArray arrayWithObjects:nil];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
}
有什么想法吗?非常感谢您的回答!!!!
谢谢你,节日快乐!
I wanna send my location coordinates as a Google Maps link (http://maps.google.com/?saddr=%1.6f,%1.6f) as an SMS but i just can't get it to work... How should I do so that the GoogleMaps-link varies to my location??
MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
controller.body = @"This is my location http://maps.google.com/?saddr=%1.6f,%1.6f";
NSString *googleMaps = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f", location.latitude, location.longitude];
controller.recipients = [NSArray arrayWithObjects:nil];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
}
Any ideas? Would really appreciate an answer!!!!
Thanks you and happy holidays!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不应该这样:
你对主体进行硬编码,然后创建一个不相关的字符串,该字符串可能格式正确,但从未对其执行任何操作。
shouldn't you have:
you're hard coding the body and then creating an unrelated string which is probably properly formatted and never doing anything with it.
假设位置是一个 cllocation 对象,您需要执行 location.cooperative.latitude、location.coordinate.longitude 。
you need to do location.coordinate.latitude, location.coordinate.longitude assuming location is a cllocation object.