Xcode 6.1 static library .a for iOS not generated

2019-04-08 21:51发布

问题:

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

回答1:

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.

  1. 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

  2. Find your build target directory. Typically, it is under:

/Users/yourName/Library/Developer/Xcode/DerivedData/yourProjectName-wholebunchofalphebets/Build/Products