I have workspace contains subprojects and one of the subprojects generates static lib which contains both ObjC and swift which is linked to main application project. I am unable to access a swift class from a static library in ObjC file in application target.
How can I access a swift class from the static library in ObjC file in application target?
I figure it out.
The issue was module-swift.h of subproject static library is generated in derivedData intermediate DerviedSource folder which is not known to main application target.
The issue resolved :)
I think, it is not possible. Xcode doesn't support Swift static libraries. You can read about it here: https://forums.developer.apple.com/thread/73900
Related
I am analyzing a swift application that includes several frameworks containing object .o files compiled from Objective-C source files, and the respective headers.
Very few of the methods in the framework libraries are being called so I want to identify what is unused. Is there a tool or linker setting that will do this?
I've found this but it doesn't work for frameworks:
https://github.com/PaulTaykalo/swift-scripts
Thanks.
I have an objective c static lib and need to write a swift app using the lib. The swift project compiles fine but it is reporting a linking error when I try to run.
This is how connect the objective c and swift.
Drag and drop the include directory with public headers to supporting files
Then added the .a lib file in to the build phases
Then created the bridging header and included the public headers of the lib there
This is the linker error I am getting
But the lib is built for armv7 according to lipo -info
What am I missing here? Is this a xcode bug(I am using xcode 6.4)?
Swift doesn't support static library.
See if updated version of your library available with swift support, That is the only work around..
I'm very new at Objective-C programming, I have a MacOSX project, with a simple UI code. It has a login function.
I have a .a extension c++11 static library, with two public headers. One includes . I d like to import the library with the headers to my project. It makes the login to my server.
I made a c++ static library target to the code, and imported the needed files, set the c++ flags (stdlib=libstdc++ and -std=c++11) and added gcc49 to search paths. But I get file not found exception to #include in my c++ header.
Have somebody a good tutorial how to solve my problem?
I've workspace with two project: static lib and cocoa application. Static library link some system frameworks(libcrypto.dylib) and include dynamic lib's .h files(openssl/bn.h openssl/rsa.h). My static library compiles successfully.
Cocoa application uses this static library and at compile time gives an error: "undefined symbols, symbols not found" (bn, new rsa etc).
But when I include libcrypto.dylib also into cocoa application project then there is no error.
Question: Xcode can do this automatically, by taking dependency from the static link library?
Thanks.
The answer is unfortunately no. It is common practice to include each single static library in the project that requires the code. That is just the way it is done.
There is an interesting article on how to handle multiple static libraries in an XCode project.
We can use iOS Static Libraries without adding header files into the project.
But i want to use the Static Libraries without adding .a files into the project
Finally, I found the solution
Path of the static library should be added in ->target->build settings-> Other Linker Flags
eg.)
/Source/iPhoneApp/libs/Connection/build/Debug-iphonesimulator/libConnection.a /Source/iPhoneApp/libs/SocialNetwork/build/Debug-iphonesimulator/libSocialNetwork.a
If you built the library, you can use dependencies to add the library project to your app project without the hassle of configuring stuff.
To do so, just drag the .xcodeproj file from your library to the app project, go to the app target properties, and add a dependency on that library, just as you'd add a public framework such as MapKit.