关于ios定位授权问题

写了个命令行工具用于输出设备的位置信息,当输入命令后出现了定位授权的问题,见下图


请问如何给这个命令行工具进行关于定位的配置授权,尝试了一下用ldid -Sentitlements.xml 授权但是不行

entitlements.xml 加入下面的key试试
<key>com.apple.locationd.preauthorized</key>
<true/>

他这里说的是需要二进制有配套Info.plist,所以比较通用的做法是利用LDFLAGS把Info.plist写入__TEXT/__info_plist 这种方法对于其他需要Info.plist的也同样适用

试了试,还是出现图中的问题,但定位权限从kCLAuthorizationStatusRestricted变成了kCLAuthorizationStatusAuthorizedAlways,
授权文件内容是这样写的,还是不行啊…

<?xml version="1.0" encoding="UTF-8"?> com.apple.locationd.preauthorized NSLocationWhenInUseUsageDescription 请求获取位置 NSLocationAlwaysUsageDescription 请求获取位置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>com.apple.locationd.preauthorized</key>
		<true/>
		<key>NSLocationWhenInUseUsageDescription</key>
		<string>请求获取位置</string>
		<key>NSLocationAlwaysUsageDescription</key>
		<string>请求获取位置</string>
	</dict>
</plist>

这个具体怎么用LDFLAGS写入啊,大神?

Google sectcreate

解决了,谢谢指点:grin:

谢谢指点:grinning: