How to ship dsym file with vendored framework through cocoapods in ios
Asked Answered
C

1

7

I have created a vendored framework that I am shipping through cocoapods. Now I would like to ship the dsym file with the framework also, so that my crashes could be shown in console and included with the archived ipa's dsyms.

I tried to copy the dsym in framework but it was throwing "bit_strip error" while archiving the build.

Thanks in advance

Chaim answered 2/7, 2019 at 6:42 Comment(2)
I am wondering the same thing but for a mac os framework.Sedda
Did you find a solution for this?Raphael
D
1

Cocoapods introduced in 1.3.0 the possibility of automatically copy the dSYMs for vendored dynamic frameworks as explained here:

CocoaPods will automatically detect and copy the .dSYM files of vendored dynamic frameworks. Place the .dSYM next to your .framework for CocoaPods to detect it and copy it to the onto the folder specified by ${DWARF_DSYM_FOLDER_PATH}.

So how this works exactly? Well, Cocoapods clone your repository locally and then clean it based on the patterns specified in the Podspec for the library. If you put your *.framework and the *.framework.dSYM in the same level of the path Cocoapods will automatically detect it and handles the copy of the dSYM to the ${DWARF_DSYM_FOLDER_PATH} folder during the archive process.

├── Stencil.framework
│   ├── Headers -> Versions/Current/Headers
│   ├── Modules -> Versions/Current/Modules
│   ├── Resources -> Versions/Current/Resources
│   ├── Stencil -> Versions/Current/Stencil
│   └── Versions
│       ├── A
│       │   ├── Headers
│       │   │   ├── Stencil-Swift.h
│       │   │   └── Stencil.h
│       │   ├── Modules
│       │   │   ├── Stencil.swiftmodule
│       │   │   │   ├── x86_64.swiftdoc
│       │   │   │   └── x86_64.swiftmodule
│       │   │   └── module.modulemap
│       │   ├── Resources
│       │   │   └── Info.plist
│       │   └── Stencil
│       └── Current -> A
└── Stencil.framework.dSYM
    └── Contents
        ├── Info.plist
        └── Resources
            └── DWARF
                └── Stencil

A good way to check also if your *.dSYM is being detected and handled it correctly is once you added it to a project take a look in the Pods-{ProjectName}-frameworks.sh and you should find a new line similar to the following one:

install_dsym "${PODS_ROOT}/Stencil.framework.dSYM"

With that line above Cocoapods will copy the dSYM to the ${DWARF_DSYM_FOLDER_PATH} folder and it will be added correctly to the *.xcarchive during the archive process.

An important point here is if your vendored dynamic framework has Bitcode enabled then the dSYM will not be enough as in this case another file called *.bcsymbolmap will be generated and it's necessary too to correctly to symbolicate your crashes. A good explanation of this can be found here by Apple.

So again how we can include the generated *.bcsymbolmap with the generated framework ?? Well, you can add to your Podspec a preserve_path to keep the reference to the *.bcsymbolmap generated, and again Cocoapods will take care of it and copy the symbols for you.

m.preserve_path = '**/*.bcsymbolmap'

A good example of it is the Mapbox-iOS-SDK-nightly-dynamic.podspec. It's very important to mention that the *.bcsymbol needs to be at the same level path as the *.framework as the *dSYM to be handled correctly.

Again to check if your *.bcsymbolmapis being detected and handled it correctly Go to the Pods-{ProjectName}-frameworks.sh and you should find a new line similar to the following one:

install_bcsymbolmap "${PODS_ROOT}/AA73DD4B-8AC5-30D1-9831-3D09CC9906D9.bcsymbolmap"
Deca answered 15/10, 2020 at 16:25 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.