question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Entitlements are not used for simulator builds

See original GitHub issue

Entitlements are ignored for buck builds targeting the simulator. For example, if you have entitlements that specify an app group for your app and extension, the app and extension will not be able to communicate in simulator builds.

For simulator builds, xcode uses adhoc codesigning but embeds the specified entitlements in the (__TEXT,__entitlements) section of the binary. This can be verified by:

otool -s __TEXT __entitlements -X /path/to/app/binary | xxd -r

Inserting entitlements into the binary requires passing additional linker flags at link time:

-sectcreate __TEXT __entitlements /path/to/entitlements.xcent

This means that entitlements would affect the binary and not the bundle, but the AppleBinary steps are run before the containing AppleBundle steps, which is currently what knows about entitlements.

I’m thinking about making a PR to fix the handling of entitlements for simulator builds but I’m not sure what the right approach is. Potentially, AppleBinary could be given a reference to the entitlements file and use -sectcreate __TEXT __entitlements flags when targeting appropriate architectures. Is that the right way to go?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ryu2commented, Feb 6, 2018

We’ve fixed this issue in e79dfd20fafcc9008cbfb2d2526bd77ac38623ba. apple_binary now takes a optional entitlements_file argument which will add the proper linker flags for simulator builds. Codesigning will also use this entitlement if specified.

0reactions
sheptingcommented, Oct 2, 2017

This has helped us as well. Here is our syntax that worked:

platform_linker_flags = [('iphonesimulator*',
                         ['-Wl,-sectcreate,__TEXT,__entitlements,ios/Entitlements-Debug.plist'])],
Read more comments on GitHub >

github_iconTop Results From Across the Web

Technical Note TN2415: Entitlements Troubleshooting
Use this document to troubleshoot entitlement related problems that can occur during an Xcode build, app installation or submission.
Read more >
Entitlements file was modified during the build, which is not ...
In Xcode click on your project target and click Build Settings. Click the "+" underneath Build Settings and then "Add User-Defined Setting" ...
Read more >
iPhoneSimulator build results in "No valid iOS code signing ...
Starting with Xamarin.iOS 8.10, if the Entitlements.plist file is set at all for the iPhoneSimulator build configuration, then codesigning is ...
Read more >
Simulator builds cannot access Keychain - Bitrise Discussions
If code signing is disabled, are entitlements included with the build? Don't you have to use AdHoc signing here? 1 Like. allenenorton ...
Read more >
Entitlements file was modified during the build, which is not ...
How to setup a file on Xcode to only build on a device and not the simulator? ... My app was just rejected...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found