Compare commits

..

3 Commits

4 changed files with 6 additions and 47 deletions
-33
View File
@@ -107,36 +107,3 @@ iconPath: Resources/AppIcon.png
> Tip:
>
> Your app icon must be a png, and it should ideally have a resolution of 1024x1024px.
## Add entitlements
You may need to add special [entitlements](https://developer.apple.com/documentation/bundleresources/entitlements) to your app, for example you need the `com.apple.developer.homekit` entitlement in order to connect to HomeKit devices.
First create an `App.entitlements` file with the necessary entitlements:
```plist
<?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.developer.homekit</key>
<true/>
</dict>
</plist>
```
Then, tell xtool about it via `xtool.yml`:
```yaml
entitlementsPath: App.entitlements
```
> Troubleshooting:
>
> There are a number of situations in which xtool may not be able to successfully apply an entitlement to your app.
>
> - Some entitlements, such as [Network Extension](https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.networking.networkextension), don't work with free developer accounts. You might need to enrol in one of the Apple Developer Programs to use these.
> - Other entitlements, like [User Notifications Filtering](https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.usernotifications.filtering), require special permission from Apple. If you do have the appropriate permission, these may or may not work with xtool.
> - Many entitlements require specific "Capabilities" to be enabled on your app in the Developer Services portal. xtool handles this for you, but we need to add code to xtool for each Entitlement-Capability mapping. If you run into a Capability that we don't handle yet, please let us know.
>
> Entitlements are a large surface area. If you find any bugs or missing functionality, please [create a GitHub Issue](https://github.com/xtool-org/xtool/issues/new/choose).
+1 -3
View File
@@ -153,8 +153,7 @@ public struct Planner: Sendable {
bundleID: bundleID,
infoPlist: infoPlist,
resources: resources,
iconPath: self.schema.base.iconPath,
entitlementsPath: self.schema.base.entitlementsPath
iconPath: self.schema.base.iconPath
)
}
@@ -218,7 +217,6 @@ public struct Plan: Sendable {
public var infoPlist: [String: any Sendable]
public var resources: [Resource]
public var iconPath: String?
public var entitlementsPath: String?
}
public enum Resource: Codable, Sendable {
+4 -10
View File
@@ -42,15 +42,6 @@ public struct XcodePacker {
throw StringError("Could not parse deployment target '\(plan.deploymentTarget)'")
}
var buildSettings: [String: Any] = [
"PRODUCT_BUNDLE_IDENTIFIER": plan.bundleID,
"TARGETED_DEVICE_FAMILY": families.map { "\($0)" }.joined(separator: ","),
]
if let entitlementsPath = plan.entitlementsPath {
buildSettings["CODE_SIGN_ENTITLEMENTS"] = fromProjectToRoot + Path(entitlementsPath)
}
let project = Project(
name: plan.product,
targets: [
@@ -59,7 +50,10 @@ public struct XcodePacker {
type: .application,
platform: .iOS,
deploymentTarget: deploymentTarget,
settings: Settings(buildSettings: buildSettings),
settings: Settings(buildSettings: [
"PRODUCT_BUNDLE_IDENTIFIER": plan.bundleID,
"TARGETED_DEVICE_FAMILY": families.map { "\($0)" }.joined(separator: ","),
]),
sources: [
TargetSource(path: (fromProjectToRoot + emptyFile).string),
],
+1 -1
View File
@@ -64,7 +64,7 @@ struct PackOperation {
)
let bundle = try await packer.pack()
if let entitlementsPath = plan.entitlementsPath {
if let entitlementsPath = schema.base.entitlementsPath {
let data = try await Data(reading: URL(fileURLWithPath: entitlementsPath))
let decoder = PropertyListDecoder()
let entitlements = try decoder.decode(Entitlements.self, from: data)