Dyld crash at launch for Xcode exported apps

Originator:macmade
Number:rdar://33376958 Date Originated:July 18 2017, 5:48 PM
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:Crash Reproducible:Always
 
Summary:

Exporting an app with Xcode 9 beta 3 (9M174d) results in a broken binary, when linking with the AddressBook framework and using NSDistributedNotificationCenter.

The application crashes at launch with the following error:

    Dyld Error Message:
    Symbol not found: _OBJC_CLASS_$_NSDistributedNotificationCenter
    Referenced from: /Users/USER/Desktop/AB.app/Contents/MacOS/AB
    Expected in: /System/Library/Frameworks/AddressBook.framework/Versions/A/AddressBook

Note that the crash does not occur when running the app on macOS High Sierra beta.
It only affects previous macOS versions (tested on 10.12 and 10.11).

Beta 3 of Xcode is the only version affected. Exporting the same app with the previous beta (9M137d) results in a working binary.

Attached is an Xcode project demonstrating the issue.
Application is linked with AddressBook.framework, and only does, in applicationDidFinishLaunching:

    [ [ NSDistributedNotificationCenter defaultCenter ] postNotificationName: @"foo" object: @"bar" ];

Complete crash report is also attached, as well as the faulty generated binary.

--------------------------------------------------

Steps to Reproduce:

Use some methods from NSDistributedNotificationCenter in an app linked with the AddressBook framework.

--------------------------------------------------

Expected Results:

App should launch...

--------------------------------------------------

Observed Results:

Application crashes with a Dyld error, because it cannot find the NSDistributedNotificationCenter class symbol in AddressBook.framework.

--------------------------------------------------

Version:

Xcode 9 beta 3 (9M174d)
macOS 10.13 Beta (17A306f)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!