Relative framework paths, the Hardened Runtime and Notarization

Viewed 2330

After successfully notarizing my app around a dozen times and it working just fine, it now goes through notarization without a hitch and then crashes on launch with:

Dyld Error Message:
  Library not loaded: @loader_path/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder
  Referenced from: /Applications/Vitamin-R 3.app/Contents/MacOS/Vitamin-R 3
  Reason: no suitable image found.  Did find:
    /Applications/Vitamin-R 3.app/Contents/MacOS/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder: code signing blocked mmap() of '/Applications/Vitamin-R 3.app/Contents/MacOS/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder'
    /Applications/Vitamin-R 3.app/Contents/MacOS/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder: code signing blocked mmap() of '/Applications/Vitamin-R 3.app/Contents/MacOS/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder'
    /Applications/Vitamin-R 3.app/Contents/MacOS/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder: stat() failed with errno=1
    file system relative paths not allowed in hardened programs

Thing is I'm not sure where exactly the runtime path for a framework is determined.. I keep the framework in ~/Libary/Frameworks/ on my development machine, but then it's copied into the app bundle and I'm not quite sure what determines the path at runtime..

Any help would be appreciated.

2 Answers

This could be a codesign certificate issue... Fix it by:

Open Keychain Access: My Certificates > "Right Click" Certificate > get info > Trust > When using this certificates > Use System Defaults

I had exactly the same issue. The solution was to add the framework to the 'Copy Files' build step as well. There you can define the destination to 'Frameworks'.

Related