swiftxcodereadfileentitlements

Is it possible to read entitlements files in swift


I am implementing universal deep linking in my app. When I registered my different domains, it creates an AppName.entitlements file

I would like to read the values of this file like a plist.

I tried

if let path = NSBundle.mainBundle().pathForResource("AppName", ofType:
"entitlements") { }

but it returns nil

Is it possible to read such files?


Solution

  • That file isn't copied in to your app (see Xcode's target checkbox). It is only used for building

    the entitlements are a config file for Xcode

    so: no

    Note that even if you add it manually to your bundle, it produces a warning similar to: Warning: The Copy Bundle Resources build phase contains this target's Info.plist file

    Workaround said warning like: https://stackoverflow.com/a/56044915/8740349