I tried to make a static library for my iOS device using Xcode 6.1.
I choose on Xcode a new project with template Cocoa Touch Static Library and named it MyLib. For MyLib target I choose iPhone 6 in the Simulator.
After the project was opened, I build MyLib with succeed.
But if I look to the Products folder, the libMyLib.a is red and nothing happens, if I want show it with finder.
In prior versions of Xcode it seems to work, how I find in some tutorials.
I found the solution: the library is created under
../Xcode/Products/Debug-iphonesimulator/libMyLib.a
If I switch the target to the my real iPhone 6 it works too and in the Products Folder the libMyLib would be black and the library is created under
../Xcode/Products/Debug-iphoneos/libMyLib.a
Open XCode and start a new project. Under iOS, select Library and “Cocoa Touch Static Library” say it as "staticlibrary". This will create a nice new project for us that builds a . a file.
clang-as-ios-dylib is a workaround for building iOS dynamic libraries from Xcode. Most importantly, it lets Xcode build iOS dylibs without requiring any modifications to the Xcode installation. It works by tricking Xcode into building an OS X dynamic library as if it were an iOS dynamic library.
Create Static Library ProjectOpen Xcode and select Cocoa Touch Static Library . Give it a name and select Swift as the development language. In our case, we will call it Networking and assume that it will contain the code to communicate with a back end. Press Cmd+N and select Swift file .
Static libraries, unlike dynamics, gather object files into one, while dynamics exist as separate files outside the executable, which means that static libraries add those files as they link, before it becomes an executable binary and dynamic libraries also have object files but are not added during compilation, they ...
This happened to me as well. I believed the libMyLib.a was built successfully and sat under Debug-iphonesimulator folder but Xcode couldn't link to the correct path. Two way you can find it.
As OP suggested, build the library with iPhone 6. The target library should be in black and right click show in folder. The library folder for Debug-iphonesimulator is at the same level as Debug-iphoneos
Find your build target directory. Typically, it is under:
/Users/yourName/Library/Developer/Xcode/DerivedData/yourProjectName-wholebunchofalphebets/Build/Products
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With