Why are static library symbols not included in dSYM during archive? - ios

We have a pretty major application suite for a client with a couple application targets utilizing several static libraries that we made in house. All targets are contained in one XCode project file.
For some reason when archiving an application the dSYM file does not contain any debug symbols for static libraries. The result is when trying to symbolicate crash logs from field agents we cannot see what is going on inside those static libraries.
I attempted to create a new simple XCode project with one application target and one static library. Even then the debug symbols were missing. I fiddled with the build settings according to this https://github.com/TheRealKerni/QuincyKit/issues/91 without luck.
If I build FOR archiving the debug symbols are included. I ran dwarfdump on the resulting dSYM file and was able to see the symbols for the static libraries implementation files. However when I then attempt to archive the project the symbols are excluded.
Am I missing something? XCode version 4.4.1

I m using XCode 5.1.1 and was having the same problem.
The fix was to set "Strip Linked Product" setting under "Deployment" section to "No" for each dependent library project. For more detail, please see my post at
can i debug ios app installed from ipa archive

This appears to be fixed in a later version of XCode, currently using 4.6 and the problem went away.
If you are stuck using an older version then do the following:
Product > Build For > Archiving
Product > Archive
Open the built product from derived data, you can do this by right clicking on the Youapp.app file in Products group and selecting show in finder. Ensure you are in the Release-xxx folder. Copy the dSYM file generated there and replace the one produced by the archive process. To find where archived files are go to Organizer, Archives tab, right click on an item and show in finder.
Hope this helps.

By default, archive uses release build, which already stripe debug symbols. you can change archive build option to 'not stripe'.

Related

Missing dSYMs in Crashlytics IOS

Hello I have been digging to find the solution but unfortunately I have not been able to find an answer. My issue is that I have my application that uses crashlytics. When pulling my crashlytics I see the Dsyms missing issue, i tried to add all the missing ones through the organizer but unfortunately i am not able to find all of them. please note my applications are not in the app store and I do not have itunes connect I am using an enterprise account. I noticed when running my application through the simulator and forcing a crash, Fabric will ask me for a new dSYM that I am not able to find. where can i find this dsym? I have verified through my build settings that I have dWARRF with dSYM enabled on both debug and release. If you have any ideas please let me know. Thank you!!
If you’re using Xcode 10 on a new project, Xcode 10 adopts a new build
ordering that is independent of the ordered list in the Build Phases
of Xcode.
Put "$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)" into your
Fabric Run Script’s “Input Files” section to ensure your
installation of Fabric goes smoothly.
Reference to Crashlytics documentation.
You can do the following (it works for me):
Archive a binary of your target. Select your Scheme and make sure you have "Generic iOS Device": selected. Then in the Xcode menu, go to Window->Organizer and you will see your build
Select the build. Check the date/time and version(build) numbers to ensure it is the one you want. Right-Click and select "Show in Finder"
Right-click in the .xcarchive file and select "Show Package Contents"
Look for the dSYMs directory. Right-click and compress.
Move the dSYMs.zip file to your Desktop for easy uploading to Crashlytics.

missing dSYM files for Instabug

I've inherited a project with several linked frameworks by virtue of gitmodules. For crash tracking we use Instabug. It keeps asking me for symbol files that I can't find. Note that I did manage to get some of the dSYM files from iTunes Connect.
An example of what it's asking me is:
F9E0A7B7-5989-3D98-A6ED-29F8D1B04A9E
Things I've tried that did not work:
1. can't find symbols for framework
2. using DWARF with dSYM Debug Information Format
3. built my project using both iOS10 and iOS11
Anyone else encounter this?
I'm using:
Xcode 9
Build target: iOS10
If you have enabled Bitcode, you can find the dSYMs inside your app's archive.
You can find the archive via the Xcode Organizer window, by selecting your app in the list on the left side of the window. Once you find the archive, right click on it and select Show in finder.
In the finder, right click on the archive file and select Show Package Contents. In there somewhere there should be a folder named dSYMs.

How to debug "Invalid Bundle" error which happens only after submitting to app store

I have a lot of frameworks in my app. App works fine in adhoc/enterprise release. Only if I submit to the app store for testflight testing I get this error email from apple:
Dear developer,
We have discovered one or more issues with your recent delivery for "My app's name here". To process your delivery, the following
issues must be corrected:
Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path.
Once these issues have been corrected, you can then redeliver the corrected binary.
Regards,
The App Store team
there is no specific information here. How can I debug it?
Got an answer from Apple Developer Technical Support which says it is a bug on Apple's side. this is the suggested workaround below which did not work for me:
To diagnose this issue, you should export the IPA you are sending to
the App Store from Xcode. Since IPAs are zip files, you can
decompress it by right clicking and saying Open With > Archive
Utility. You should find your main executable inside the unzipped
folder structure and run otool at the command line to see the library
list: otool -L
The list of paths you get should match what you find inside of your
IPA. All of your libraries should start with #rpath. A simple
comparison of everything in this list with the unzipped IPA folders
should reveal what is missing.
Once you know what is missing, go to your Xcode build phases setup.
There should be a build phase for either Copy Files or Embed
Frameworks that includes the missing library — you should just add the
library to the list. If you don’t see either of these build phases,
you can recreate it by adding a new Copy Files build phase, setting
the Destination to Frameworks, and adding the library to the list,
ensuring that Code Sign On Copy is checked.
If you don’t find anything missing in your main binary, make sure to
do the same search on any other binaries you may have, like for a
watchOS app or an iOS app extension.
If you find that all of the frameworks are in this build phase, please
take a look at the Embedded Binaries section of your app target’s
General page, and let me know if you see multiple levels of ../ next
to the binary that you found is missing.
Please let me know if it works for you!
I have encountered the same issue when uploading an app with watch support to the app store.
I was able to solve it with the hint from the first answer, using otool -L to analyze the binary from the ipa or xcarchive.
However, the problem was not with my frameworks (at #rpath) but with a swift lib. I noticed that libswiftWatchKit.dylib was missing in the frameworks folder.
The solution that worked for me was as simple as to set EMBEDDED_CONTENT_CONTAINS_SWIFT=YES in the build settings of the watch app (or the watch app extension, but not both). After that, all necessary swift libraries were correctly copied to the watch app path in the archive and upload to app store was working correctly.
Apparently, the watch app works and upload passes if you provide the necessary swift libraries only in the main app's folder.
After adding the custom Swift framework to my project I got this email after uploading the app to iTunes connect.
I got this email from iTunes store,
Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search path.
The fix is simple for this issue,
Step 1: Make sure your Custom framework is added to Embedded Binaries in General tab of your target.
Step 2: Under build settings,
Set Always Embed Swift Standard Libraries = Yes for your main project target.
And Set Always Embed Swift Standard Libraries = No for your custom framework target.
This solved my problem and I was able to upload binary to iTunes connect.
Ref
Tried all the above solutions and did not work for me.
I was experiencing this issue in Xcode 10.1 recently and all my frameworks were referenced correctly (did otool -L and everything lined up).
Seems there were some changes in the apple validation process, may be a bug, may not be on Apple's end, but all my prior builds uploaded and validated fine -- and I did not add any new frameworks since.
Upon uploading the binary to iTunesConnect, I'd see the following error:
Invalid Bundle - One or more dynamic libraries that are referenced by
your app are not present in the dylib search path.
Invalid Bundle - The app uses Swift, but one of the binaries could not
link to it because it wasn't found. Check that the app bundles
correctly embed Swift standard libraries using the "Always Embed Swift
Standard Libraries" build setting, and that each binary which uses
Swift has correct search paths to the embedded Swift standard
libraries using the "Runpath Search Paths" build setting.
MY SOLUTION:
After days of debugging, what worked for me was to disable 'Include bitcode for iOS content' upon uploading the archive from Xcode organizer. Seems that this option modifies the binary which caused the validator to fail.
Or you can disable bitcode in your Build Settings
My Problem:
I had the same error with embedded frameworks.
The App project has Custom Framework project
Inside the Custom Framework project is another Custom Framework project
The app built to the simulator and to devices with no problem but failed the Apple test, returning "Invalid Bundle".
I inspected the package just like Taha had been told to by Tech Support and everything was present and correct!
My Solution:
I restructured the project so that the two custom frameworks sit side by side and one is no longer embedded within the other.
This looks to be an Apple validation problem since everything works fine on devices and the simulator but the work around was straight forward.
In my case, in the build settings, this was fixed when I added the following to the build settings for the library:
DYLIB_INSTALL_NAME_BASE = #rpath
The clue was a linker warning: 'YourLibrary has an install name beginning with “/”, but it is not from the specified SDK'
Had same issue. This happened to me because one of my Framework target was added to main target in "Link Binary With Libraries" but was not added to "Target Dependencies" and "Embedded Binaries"
I also received a similar mail from Apple:
Dear Developer,
We identified one or more issues with a recent delivery for your app,
"********. Please correct the following issues, then
upload again.
ITMS-90562: Invalid Bundle - One or more dynamic libraries that are
referenced by your app are not present in the dylib search path.
Best regards,
The App Store Team
I used my own framework for my watch app. I solved this issue by changing the framework option to "Embed Without Signing" in the Extension Target. The default option was "Do Not Embed".
I had the same problem, it was due to one framework not being present in the Frameworks subfolder in the app bundle.
I fixed it by adding a Copy Fields build phase, and adding the missing .framework file there.
This error message is also addressed in Apple Technical Note TN2435
Embedding Frameworks In An App: https://developer.apple.com/library/archive/technotes/tn2435/_index.html
You can find the error message under the heading "Missing Framework Bundle" with troubleshooting steps.
We had the same problem, and even after going through all the steps (see "Missing Framework Bundle"), the only thing that worked was disabling Bitcode.
So I struggled on this for two days. What it turned out to be was I had UITests checked in Archive for the Build for the Scheme I was archiving.
After unchecking it from Archive, re-archiving it, validating it (although validating it before always passed), and "Upload to AppStore" I did not get the e-mail from Apple informing me of Invalid Swift Support. Instead I got the e-mail that it'd been processed and is good to go!
In my case, I've had to add a framework from Notification App Extension to the main target (embed & sign in the main target, do not embed in the extension) - even though there was no mention about it in otool -L output.
Funny thing that Iterable official doc says that the framework should be embedded & signed in the extension - which would lead to another upload problem because of nested bundles.

How to archive/export Framework in Xcode?

I have a project with a framework target, but when I archive, the framework does not show up in organizer. I checked apple for documentation, but only found reference for static libraries.
Has anyone experienced this before?
Here are screenshots of my current scheme settings
Go into your framework and build.
cmd+b
You will find in your products YOUR_FRAMEWORK.framework
Right click on "YourLibrary.framework" -> Show in Finder
Now you can share/import your library.
Attention: Don't link/reference to this path because the framework is stored in Derived Data.
The only thing you should do is build the target,then show Products in finder ,you will see it.
The steps are documented by Apple here
Set up the project
To set up your project for creating an XCFramework, ensure your Xcode project has a scheme that builds only the framework target and its dependencies.
Configure these build settings on your target:
Set the Build Libraries for Distribution build setting to Yes. For Swift, this enables support for library evolution and generation of a module interface file.
Set the Skip Install build setting to No. If enabled, the built products aren‘t included in the archives.
Leave the Architectures build setting unset. The predefined value configures the target to build a universal binary for all the possible architectures the target platform uses.
Then you can use Archive to build your framework for Release.
Once built, the Organizer window will open.
You can then click on Distribute Content -> Build Products and export your framework.
Archive framework
Product -> Archive
//or
xcodebuild archive
[Archive location]
Xcode v12 does not have such problem and when you try to archive a framework Xcode prompt you to corresponding Archives window
Archive is an action from Scheme[About] which is competitor for Build action. Archive includes Build with additional logic. For example Archive is used for XCFramework[Example] which additionally can contains .dSYM and .BCSymbolMap files
For usual purposes you can just use Build action, it creates a corresponding .framework file in a Build location[About]

Why does xcode archive succeed but create an empty .xcarchive file?

Background
I have an application I'm trying to archive and submit to the app store for approval. Part of the process requires the archive to be prepared and loaded using application loader. I used product-> archive and it prompts archive succeeded but it does not appear on the Organizer -> Archive tab.
Detail of Project build
1 app target, "AppName"
1 static library, cocos2d libraries (cocos2d v0.99.5-rc1)
Xcode Version 4.0.2
First steps
Setting "Skip Install" to "No":
Project
AppName target
cocos2d libraries
Setting skip install on the three allows me the archive to be built and show up(non-empty xcarchive) on the organizer. However, when I try to validate, it'll prompt:
"AppName" does not contain a single–bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single–bundle application.
I checked that the archive package contents include the cocos2d libraries within a directory "Products". According to some posts and the cocos2d forum, we're not supposed to submit that as part of the binary for approval.
Steps taken to the Zero KB .xcarchive
Since the static cocos2d libraries library should not to be included, I've changed the cocos2d libraries target to have skip install: "Yes". Now, if I archive the project it prompts build succeeded but it creates an empty .xcarchive file that cannot be seen on the organizer->archives tab.
I have the solution to my problem and if anyone else is facing the same problem here are the steps i took to fix the problem.
cocos2d library
-Set the skip install to YES for all configurations in your cocos2d library.
-Set the code signing identity to Don't code sign for all configurations. Static libraries are not code signed.
-Update the installation directory to /usr/local/lib.
app library
-Update the installation build products location to /tmp/$(PROJECT_NAME).dst
-Update the installation directory to $(LOCAL_APPS_DIR) (/Applications).
-Update the code signing identity section.
What worked for me was to delete the lines SKIP_INSTALL = YES; from the various *.pbxproj files.
Hat tip to this blog. (No instances of INSTALL_PATH found in our files.)

Resources