Custom Cocoa Touch Framework clashes / conflicts with a private framework name

Originator:ncreated
Number:rdar://42964949 Date Originated:August 6 2018
Status:Closed Resolved:
Product:iOS + SDK Product Version:
Classification:Crash Reproducible:Always
 
Summary:

When custom Cocoa Touch Framework target is named the same as some of the Private Frameworks the app crashes during the launch on iOS Simulator.

The runtime seems to look for private framework APIs in the custom framework, which results in `dyld: Symbol not found:` runtime crash. In fact, when setting `DYLD_PRINT_LIBRARIES = 1` environment variable we can clearly see that only the custom framework is loaded by `dyld`, not both (the private and custom one).

Steps to Reproduce:

1. Create empty project with "iOS > Single View App" template;
2. Add "Cocoa Touch Framework" target named "Network" (use default settings of embedding it in the main application);
3. Launch the app on iOS Simulator.

Expected Results:

Application should run on the Simulator.

Actual Results:

It crashes with:
```
dyld: Symbol not found: _OBJC_CLASS_$_NWPathEvaluator
  Referenced from: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/UIKit.framework/Frameworks/DocumentManager.framework/DocumentManager
  Expected in: /Users/<user>/Library/Developer/Xcode/DerivedData/PrivateFrameworkConflict-flugbttcnxtcfzbndpivtokdztlc/Build/Products/Debug-iphonesimulator/Network.framework/Network
 in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/UIKit.framework/Frameworks/DocumentManager.framework/DocumentManager
```

Configuration:

Xcode: Version 9.4 (9F1027a)
iOS Simulator: iPhone 8 Plus (11.4)
macOS: 10.13.4 (17E199)

Comments

Apple Engineering feedback

Apple Engineering has provided me the following feedback regarding this issue:

"Yes, you shouldn’t create frameworks that conflict with system frameworks."


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!