简体   繁体   中英

Swift Objective-C header is not found when archiving the app

I am trying to add Swift class in one objective-c file for which I had to add *-Swift.h file in my objc file. While the project works fine in debug mode but when I try to archive my app it's throwing error saying that particularly that *-Swift.h file is not found. I tried many solutions but none of them worked. Then I got this question on apple website which is exactly the same problem but his solution which was to set precompile prefix header to YES also did not work for me. ( https://forums.developer.apple.com/thread/7512 ).

I do understand that this header is generated in derived data and build process for debug and archive is different but nothing is working in my case.

I have one framework inside which my app target is located. I am adding the header in my objc as #import "My_Project-Swift.h"

I am using XCode 10.

Here is what worked for me:

  1. In Xcode: Product -> Clean (Shift+Cmd+K)
  2. Delete Derived Data
  3. Change Precompiled Prefix Header to YES in the target build settings
  4. Close Xcode
  5. Open Xcode
  6. Archive

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM