apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.16k stars 989 forks source link

iOS - Xcode - "Code Signing Entitlements" (CODE_SIGN_ENTITLEMENTS) should be set on the target level instead of project level #1135

Closed jkasten2 closed 2 months ago

jkasten2 commented 3 years ago

Bug Report

"Code Signing Entitlements" (CODE_SIGN_ENTITLEMENTS) should be set on the target level instead of project level. This results in the signing entitlements to point to the same file when creating a new target.

Problem

This creates a problems where if you add a Capability in Xcode to either your new target or the main Cordova one it is added to all other ones.

What is expected to happen?

I would expect a .entitlement for each target.

What does actually happen?

"Code Signing Entitlements" get set on the "Project" instead of each target to $(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-$(CONFIGURATION).plist. image

Information

If you create a new Xcode project you can see the "Code Signing Entitlements" is set at the Target level instead of Project. Project Level is blank: image

Target level is set for main target: image

My other target has it's own file: image

Cordova code reference

The value is being assigned here: https://github.com/apache/cordova-ios/blob/6.2.0/bin/templates/scripts/cordova/build.xcconfig#L43 However the change isn't simply updating this value (as I don't believe Xcode has a $(TARGET_NAME) place holder.

Version information

Cordova Packages:

    cli: 10.0.0
        common: 4.0.2
        create: 3.0.0
        lib: 10.0.0
            common: 4.0.2
            fetch: 3.0.1
            serve: 4.0.0

Project Installed Platforms:

    ios: 6.2.0

Project Installed Plugins:

    cordova-plugin-whitelist: 1.3.5

Environment:

    OS: macOS 11.5.1 (20G80) (darwin 20.6.0) x64
    Node: v16.5.0
    npm: 7.19.1

ios Environment:

    xcodebuild:
Xcode 12.5.1
Build version 12E507

Checklist