简体   繁体   中英

iOS App crashed when i try link swift framework with objective - c project

I have problem app crashed when i try link swift framework with objective - c project

dyld: Library not loaded: @rpath/libswiftCoreImage.dylib
  Referenced from: /Users/arcilite/Library/Developer/Xcode/DerivedData/SamplesAdaptiveController-fpznutybiarsvsbwskrhgwflbcdo/Build/Products/Debug-iphonesimulator/AdaptiveController.framework/AdaptiveController

Do you have any ideas? I can use swift framework in objective - c code? Thanks

PS Xcode 6.0 release. Simulator

I faced a similar issue while trying to call a function from a pure Swift framework in an existing Objective C app. I was using XCode 6.1 and an iOS 7.1.2 device and had tried all the other recommendations on Stack Overflow.

Create a dummy Swift file in your Objective-C project (if you don't already have any Swift file in your project). In that Swift file, just add this line to import UIKit:

import UIKit

That seems to force XCode to package the required Swift libraries in the app and stop it from crashing.

This can occur if you're using a library but aren't using Swift elsewhere in your code. Try setting the Embedded Content Contains Swift Code to YES in your project's build settings. From Apple:

When building an application that does not contain Swift source files but embeds other content (like frameworks, XPC services, app extensions, and so on) that does contain Swift code, you must set the build setting Embedded Content Contains Swift Code (EMBEDDED_CONTENT_CONTAINS_SWIFT). That way the Swift libraries will be included in the application.

Hope this helps!

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