4

enter image description hereHi i have created a framework with a swift file having a public class. When i try to use this public class in the app project that i have linked this framework to , the xcode shows that there are no such class.

public class TestFrame {
   public func hello() {
       print("Hello World")
   }
}

This is the class from my framework.

First i build the framework for my device, then link that file to the embedded binaries in my app project. Then i include a import statement of the framework name and then try to use this class(which is not possible at this stage).The Only file that i am able to access through framework is the .h(header file) of the framework. So what i need to do to get this class accessed in my app project.

4 Answers 4

2

The problem is that you built the framework for the device (arm) and now you are trying to link it to the simulator platform (i386).

You can either build two frameworks (one for the device, one for simulator), build a 'fat' framework including both architectures or you drag the framework project to your workspace so it is always built with for the selected target platform.

Sign up to request clarification or add additional context in comments.

2 Comments

btw. what happens if you select the device as build target?
then also same result
1

For anyone with the same problem:

Try building your framework for Generic iOS Device and then import it again.

Comments

0

For me it was because I moved the framework files from another project, grouped inside a folder and it lost the target. So I had to add a target to the classes before I was able to see them in the main project.

Comments

0

For me it was because I used the same name of the framework for a class name. 🤦

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.