Xcode 6.1 static library .a for iOS not generated - ios

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

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

Related

Run a project without accessing frameworks for real devices

I have an issue: I have built-in frameworks via "Frameworks, Libraries, and Embedded Content" that work only on real devices, while their source code is not available and I can't create version for simulator. However, I need to run the project on the simulator, and the functionality that is associated with the frameworks is disabled for the simulator with:
#if targetEnvironment(simulator)
#else
import MyFramework
import MyFramework1
#endif
However, when we try to start the project in simulator mode, I get an error -
Building for iOS Simulator, but the linked and embedded framework
'Framework' was built for iOS.
At Build Phases -> Link Binary With Libraries for my target I selected optional status for MyFramework and MyFramework1
Any suggestion how to fix run for simulator without these frameworks are welcome!
I've found useful fix for my case. This fix is based on this. I just excluded the folder for the simulator (Any iOS Simulator SDK) where the frameworks are physically located. I've added path like this "$(SRCROOT)/my_project/my_libs/*"

Invalid deployment target of the framework

I want to decrease the framework deployment target from iOS 10 to iOS 9. I did the fork of the library, changed deployment target of the framework TARGET (not whole project). When I build the dependency I can see in info.plist that deployment target is iOS 9 (screenshots attached) in the framework and iOS 8 in the framework's dependency. Anyway, my project where I attach those still outputs that iOS 10 is required for this framework (yes, i did clean, delete derived data, change simulator, reset xcode).
.../MyFile.swift:13:8: Module file's minimum deployment target is ios10.0 v10.0:
.../MapFramework.framework/Modules/MapFramework.swiftmodule/arm64.swiftmodule
(that's in Swift file in the line where I have import MapFramework)
The issue was happening, because by mistake, there were two copies of the same .framework in the file hierarchy. One was in Carthage folder, another one in root folder. Even though marking in Xcode -> Reveal in Finder on the framework it always shown framework in Carthage folder, somehow it was processing both of these. After removal of the framework located in root folder everything was working perfectly fine (I didn't have to change any paths or references in Xcode, what shows that Xcode all of the time was pointing to the correct version).
Seems like an Xcode bug.

XCode creating half-sized static library

This issue is driving me nuts. I am asking it here before I announce it as a bug in XCode and try to use another version of XCode.
So, I am using XCode 8.3.2. I have a project that generates a static library. I am moving the .a file to another project and I use it (I know I can integrate the static library project in the second project but I don't want that here).
The file generated is 4.4MB. After copying the newly created .a and I copy it to the second project and test it, everything works fine. But when I come back to the library project and build it, the generated file is 2.3MB with missing symbols!!!
I cannot make it work unless I restart my MAC, or XCode somehow crashes.
What I have tried : Clean project, clean folder, delete Derived data, added -all_load -force_load -ObjC flags in my target linker flags.
If anyone has any idea about what is happening, please inform me.
Thanks!
It depends upon the target device you have selected during building your library. In Xcode, When you select any specific simulator or device, that time Xcode only creates single slice or thin product.
If you select Generic iOS device , means no device or simulator, that time Xcode create library having all the device slices and one folder having Simulator slice.
By using LIPO command you can put simulator and device slices together.
In your case, during first and second time, You are changing the device target from Generic iOS Device to specific device.

Profiling app with Cocoa Touch Framework in Instruments does not show any symbols

I have an Xcode Cocoa Touch Framework project (written in
Objective-C) that produces a .framework directory as well as the
corresponding .dSYM file. Its using iOS 10.1 as its Base SDK
with a deployment target of 8.0. All built using Xcode 8.1.
I would like to profile my framework using Instruments so I've added
my framework into a separate Xcode project (written in Swift). It
builds and runs fine. However in Instruments, the symbols from my
framework are not showing.
In the Instruments menu: File -> Symbols, it shows that there are
Missing symbols but they are all from System Frameworks
(/usr/lib/dyld)
When I try to set the dSYM path to the dSYM file of my framework, it says that:
No new libraries to symbolicate. The specified path didn't locate a dSYM for any of the selected libraries.
Am I profiling my framework the wrong way? Or am I missing other settings in my framework's build settings?
Any help is appreciated. Thanks!
The problem went away once I profiled the app in an actual device instead of the simulator.

iOS Development: problematic framework search path

I have an iOS app and I want to test it on simulator. When I run the project xcode complains that my framework file is "missing required architecture i386 in file".
I did a bit of search on line and it says that's because xcode used the framework files intended for actual device when building the project for simulator. Solution is to add the simulator framework folder under the framework search path in build settings.
Okay now the problem is, doing that solves the problem of building project on simulator, but later when I want to build the project on an actual device, xcode starts complaining again saying there are redefinitions of some of the openGL typedef in the framework. To fix this I have to remove the search path item that I added.
So is there an easy way to avoid having this kind of problem? I don't want to switch the search path over and over again when I want to build the project on different platform.
If you upgrade a project from 4.2 to 4.3.2 style it often loses the architectures required for the target you are building for. Usually you just have to add them back or change the target SDK.

Resources