Xcode does not generate DYSM for SPM dependencies - swift

Xcode is not generating dSYM files for my three SPM dependencies.
I have tried creating a new Swift only project and including a SPM package like CocoaLumberJack and even there I am not given a dSYM for release.
I am using Xcode 12.0.1, I have looked through all kinds of build settings with no luck to force them to be generated or find where Xcode puts them if it is generating them.

Swift packages by default are treated as static library, that is why you don't see the embed options for them in Frameworks, Libraries, and Embedded Content section:
Static libraries don't require separate dSYM files are they don't have any executable. They are directly contained in consuming app executable so the static library symbols will be available in application's dSYM file. If you inspect you app's ipa you won't find the swift package module in Frameworks directory.
You can also make your swift package exposed product dynamic library by specifying library type as .dynamic:
.library(
name: "SwiftLibrary",
type: .dynamic,
targets: ["SwiftLibrary"]
),
This will make your package module dynamic library and will allow you to choose embed option in XCode:
If you make your package module dynamic and you can inspect your ipa to see this embedded in the Frameworks folder. After making your package module dynamic you separate dSYM file will be generated for it.

Related

Is it possible to import and add .xcframework file to a static xcode library project?

I have set of .xcframework files, and currently I working on a static library
I need to integrate those .xcframework files into my static library, but it seems Build settings menu and build phase menu on a static library project is different and I can't add .xcframwork files like I used to do on a Xcode app project
You add dependencies under Build Phases tab, in Link Binary With Libraries step:
Be advised that in this scenario you cannot embed any framework. It either has to be delivered alongside the library or adding the dependencies has to be part of the library integration instructions. I.e. the consumers of your library will need to add this xcframework dependency manually in their target.

Add .framwork to a Swift Package?

I have a Swift package I would like to make public, however I do not want the source code for all of the files shared.
My solution was to bundle the private source code into a .framework and have the swift package call the private source code.
However I cannot seem to be able to add the .framework into the Swift Package project. Any help?
There is an accepted proposal for binary dependencies in SwiftPM. So when that feature ships you will be able to zip up your framework, if it is an xcframework, and link against it. Until then you can only use unsafe linker flags to do so which means you canโ€™t use the package with Xcode unless it is a local package.

swift package manager link dynamic lib

i used swift on linux, made the Package.swift file including some libraries, but when i built the project with swift build command, the libraries were static linked with the executable file. i tried to generated a Xcode project used the swift package generate-xcodeproj command, built the project in Xcode, then opened the Product directory, i found that the libraries were dynamic linked with the executable file, what did the Xcode doing? and how can i build it as a dynamic link use swift build command, could you help me๐Ÿ˜”๐Ÿ˜”
SwiftPM version 3 was only able to build executables with statically linked libraries. In SwiftPM version 4 (currently in beta, will be released this fall) you can also build with dynamically linked libraries. See SE-0146 for more information.

Is it a good practice to have more than one *.xcodeproj file in an xCode project?

I want to know what's the best practice to use when integrating external SDK to my project, specifically how to handle the *.a file and the *.xcodeproj file.
Examples of external SDK packages: PhoneGap, Facebook, Google-Analytic.
Is there a reason to copy the *.xcodeproj to my existing project or is it enough to just use the *.a file?
Are there pros and cons for having more than one *.xcodeproj file in a single project?
You would never copy the .xcodeproj into your app.
Typically you would add the library (./a) or any headers and implementation files required (.h & .m).
Often you would compile the 3rd party SDK xcode project to a library file and include that compiled library file.

How to build universal static library that works for os3.x and os4.x

Hi I'm trying to create a static library that can added to any ios project, but I can only get it to work such that if I build the library in ios3, it'll work for ios3 projects but not ios4 and vice versa.
The errors I get are:
Undefined symbols:
".objc_class_name_UIImage", referenced from:
literal-pointer#_OBJC#_cls_refs#UIImage in Test3-Release.a(TestViewController.o)
".objc_class_name_NSNotificationCenter", referenced from:
literal-pointer#_OBJC#_cls_refs#NSNotificationCenter in Test3-Release.a(Test.o)
So it looks like it's not finding Foundation and UIKit frameworks for the library?
Here's what I've done so far:
I have 2 projects: 1 is a library project with a library build target. The other is a Test Project that tries to use the library built in the first library.
1) Create a project with a static library target and added all of the implementation files
2) Added libraries like UIKit, Foundation, etc to the "Link Binary with Libraries folder and Set all the linked libraries to have a weak type in my library target.
3) Built the library, added it to my test project, along with my header files.
4) In my test project, I set other linker flags to -ObjC -all_load for all build configurations
When I compile it gives me a bunch of errors as if I didn't include any frameworks.
Anyone have any ideas on what I should do?
Hint (Maybe?)
I also noticed that adding any frameworks to the "Link Binary with Libraries" folder in my library target doesn't seem to do anything. I added CoreLocation to that folder, but when I try to compile in my Test Project it won't compile until I add CoreLocation to my Test Project Frameworks folder.
your dependent project (that uses static library) hassn't linked Framewrok libraries.
Just add to dependent project frameworks (uikIt,Foundation, etc) all will work fine.