将用户位置坐标作为 googleMaps 链接发送到 SMS.app

发布于 2024-10-09 03:40:32 字数 751 浏览 3 评论 0原文

我想将我的位置坐标作为 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情感失落者 2024-10-16 03:40:32

你不应该这样:

controller.body = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f", location.latitude, location.longitude];

你对主体进行硬编码,然后创建一个不相关的字符串,该字符串可能格式正确,但从未对其执行任何操作。

shouldn't you have:

controller.body = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f", location.latitude, location.longitude];

you're hard coding the body and then creating an unrelated string which is probably properly formatted and never doing anything with it.

や三分注定 2024-10-16 03:40:32

假设位置是一个 cllocation 对象,您需要执行 location.cooperative.latitude、location.coordinate.longitude 。

you need to do location.coordinate.latitude, location.coordinate.longitude assuming location is a cllocation object.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文