Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 473 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use Swift App + (Swift Framework + Objective C static Framework) without warnings

#1
**What I am trying to do:**

- Create a swift dynamic framework - Say SwiftDemo.framework
- Swift.framework depends upon an external Objective-C static framework
(No source code available) - Say ObjCDemo.framework. This framework has
it's module file and placed inside ObjCDemo.framework/Modules/module.modulemap
- Put this SwiftDemo.framework inside an Swift application. Ideally I would want my swift app to be able to use both SwiftDemo.framework and ObjCDemo.framework without any error or warning.

**What I have tried:**

- Create a swift dynamic framework SwiftDemo.framework

- Added ObjCDemo.framework in *"Linked Frameworks and Libraries"*. Put ObjCDemo.frameworks path in "Framework Search Paths" if not added automatically. Access ObjCDemo.framework using *"import ObjCDemo"*. Build the SwiftDemo.framework. It builds fine, No error, No warning

- Create a SwiftDemo application.

- Add SwiftDemo.framework in *"Embedded Binaries"* section.

Try to build SwiftDemo.app, below is the error:

> ld: framework not found ObjCDemo for architecture x86_64

Obviously SwiftDemo.app not able to find the ObjCDemo.framework which is used by SwiftDemo.framework, So next I did:

- Added ObjCDemo.framework in *"Linked Frameworks and Libraries"* and accordingly set the *"Frameworks Search Paths"* of SwiftDemo.app target

Try to build SwiftDemo.app, No error but this is the console warning I get for every file in ObjCDemo.framework:

> objc[15127]: Class <classname> is implemented in both /Users/tarun/Library/Developer/CoreSimulator/Devices/4391A259-64DF-4893-BE09-31B5D2D5BC8C/data/Containers/Bundle/Application/CD896A7B-1868-44D1-BFEA-6CC081AD41DB/SwiftDemo.app/Frameworks/SwiftDemo.framework/Swift and /Users/tarun/Library/Developer/CoreSimulator/Devices/4391A259-64DF-4893-BE09-31B5D2D5BC8C/data/Containers/Bundle/Application/CD896A7B-1868-44D1-BFEA-6CC081AD41DB/SwiftDemo.app/SwiftDemo. One of the two will be used. Which one is undefined.

Obviously these files are duplicated in both SwiftDemo.framework and SwiftDemo.app, So to avoid next I did:

- Remove ObjCDemo.framework form *"Linked Frameworks and Libraries"* of
SwiftDemo.app target but keep *"Frameworks Search Paths"* still
pointing to ObjCDemo.framework path.

Try to build SwiftDemo.app, No error but this is the compile time warning:

> ld: warning: Auto-Linking supplied '.../SwiftDemo/ObjCDemo.framework/ObjCDemo', framework linker option at ..../SwiftDemo/ObjCDemo.framework/ObjCDemo is not a dylib

No matter what I just couldn't get pass these errors or warnings. Anyone got any solution to this?
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through