Skip to Content
Swift游戏开发经典实例
book

Swift游戏开发经典实例

by Jonathon Manning, Paris Buttfield-Addison
January 2020
Intermediate to advanced
356 pages
6h 4m
Chinese
China Electric Power Press Ltd.
Content preview from Swift游戏开发经典实例
108
3
CMAttitudeReferenceFrame.XMagneticNorthZVertical
偏航角的零点指向正北角。
CMAttitudeReferenceFrame.XTrueNorthZVertical
偏航角的零点设置为正北角。同时,系统会使用定位系统。
如果我们需要最精确的数据,应该使用最后一个选项。这个选项最耗电量,同时也
最耗时。如果你不是太在乎到底哪个方向是北,使用
CMAttitudeReferenceFrame.
XArbitraryZVertical
选项或者
CMAttitudeReferenceFrame.
XArbitraryCorrectedZVertical
选项就可以了。
3.11
获得用户的位置
问题
如何获知用户当前的地理位置。
解决方案
当你想使用用户的位置信息时,你应该向用户说明你使用这些信息的目的是什么:
1.
在项目导航窗口(位于
Xcode
窗口的左边)中,点击顶部的项目文件,打开项
目的
Info
窗口。
2.
Targets
列表中选中该项目的
target
3.
点击
Info
标签。
4.
在设置列表中添加一个新条目“
Privacy - Location Usage Description
”,类型
String
,在
Value
一栏里填入你向用户解释的内容,比如用户的坐标信息的
用途之类的(例如在我们的例子中,我们可能会填写“这个程序将会显示你的
坐标”)。
你需要向用户说明应用程序使用用户位置信息的用途:
如果
App
只在运行时才使用用户位置信息(也就是说程序在前台的时候),你 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精通機器學習

精通機器學習

Aurélien Géron
FreeBSD® Unleashed

FreeBSD® Unleashed

Brian Tiemann, Michael C. Urban
深入淺出代數

深入淺出代數

Tracey Pilone, Dan Pilone
Swift学习手册

Swift学习手册

Jon Manning, Paris Buttfield-Addison, Tim Nugent

Publisher Resources

ISBN: 9787519840129