Time profiler doesn't show me functions - ios

In tutorial, when someone debug app they see something like this:
But when i start recording, by pressing red button:
I see this...

Make sure the Generate Debug Symbols build setting is set to Yes. You need debug symbols to have function names appear in Instruments.
If your project is generating debug symbols, Instruments may not be able to find your project's dSYM file. In Instruments choose Instrument > Call Tree Data Mining > Locate dSYM file to find and open your project's dSYM file. Your project's dSYM file is usually located in the same directory as the application bundle of your project's release version. Additional information can be found in the following article:
Instruments: Locating dSYM Files

I had 2 different versions of Xcode 9.4.1 and 10.1 both of them had command line tools which were in conflict(i suppose). To fix this issue I set right command line tools version there:
"Xcode -> Preferences -> Locations tab -> Command line tools".
Also check Build Settings and set "DWARF with dSYM File" to your target.

Related

Firebase Crashlytics with Swift Package Manager - crash because of wrong path

I have installed Firebase through the Swift Package Manager for my iOS project, including Crashlytics. I have followed these instructions and added the required script to build phases:
https://firebase.google.com/docs/crashlytics/get-started?platform=ios
So the path for execution is:
"${BUILD_DIR%/Build/*}/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run"
On start up (iPhone simulator), the app crashes with the following error message:
/Users/[path-to-my-project]/SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run: No such file or directory Command PhaseScriptExecution failed with a nonzero exit code
I don't understand why it tries to find the crashlytics script in my Xcode project folder and not in the derived data folder at runtime.
I checked the derived data folder and followed the path. Indeed, the Crashlytics run script is at the expected path.
thanks for any hints in the right direction
In the meantime I've found out that the path to the build folder is set globally in the Xcode preferences. For some reason I don't recall, my build folder has always been in my project folder for all projects I ever worked on in Xcode... I know this for sure because I always add the build folder to .gitignore.
To change the build folder to be a subfolder of your project's derived data folder, go to:
Xcode -> Preferences -> Locations -> Advanced and select the first option.
Firebase assumes that this option is selected by default (maybe it is and I'm the weirdo...).

Debug information "DWARF" and crash logs

I am trying to map my understanding of "DWARF" vs "DWARF with dSYM file" debugging info formats to what I see in the crash information for different iOS build configurations.
I was trying to fix a problem, where crashes on the build with debug configuration were not symbolicated by default. These were my build settings before the problem was fixed -
Strip Linked Product - Debug - No, Release- Yes
Strip Debug Symbols during Copy - Debug - No, Release - Yes
Debug Information Format - Debug - DWARF, Release - DWARF with dSYM file
What got it to work was setting the Debug information format to "DWARF with dSYM File" for debug configuration as well.
My questions is - why do I need to to set the format to "DWARF with dSYM File" if I am specifying that the product should not be stripped of its symbols into a dSYM file (in the strip linked product setting)?
My (probably incorrect) understanding was that if I set it to DWARF, then all the debug information would be inside the app binary and I do not need a separate dSym file for symbolication? Please help me with a better understanding of this.
On Apple's platforms, DWARF is never baked into the executable (except for unwind info). Enabling DWARF debug info just means that the .o files contain DWARF-formatted debugging info. The linker doesn't bring that into the executable, though.
If you request a dSYM file, a separate build step uses dsymutil to collect the debugging info from the .o files into a dSYM bundle or file.
Debuggers can use a map in the executable to look up the debug info in the .o files when needed, assuming you're debugging on the build machine. That's why you don't typically need a dSYM file for a Debug build. Symbolication doesn't have the executable, just a UUID for it. It could find the dSYM using the UUID, but it doesn't have the information to find the .o files.
See this answer by an Apple developer involved in implementing this stuff. Also, this older wiki article he wrote.

How to address this warning generated by crashlytics / fabric?

Here is what I know/do:
I am importing Fabric via a pod.
The build script for Fabric is the last one
It is set to generate a dsysm
DEBUG_INFORMATION_FORMAT should be set to dwarf-with-dsym for all configurations.
This could also be a timing issue, make sure the Fabric run script build phase is the last build phase and no other scripts have moved the dSYM from the location Xcode generated it. Unable to process myapp.app.dSYM at path /Users/no-one/Library/Developer/Xcode/DerivedData/myapp-ahatoktzxteqbcaohqnktdtfczxr/Build/Products/Debug-appletvos/myapp.app.dSYM
Make sure your project build settings are generating a dSYM file.
Go into your target's Build Settings and then type in DEBUG_INFORMATION_FORMAT into the Search Bar that appears in the top right.
It looks like this:
And you can choose "Dwarf With Dsym" from the pop-up menu.

Debug warning Xcode - dwarf-with-dsym?

I get this warning upon compilation:
DEBUG_INFORMATION_FORMAT should be set to dwarf-with-dsym for all configurations. This could also be a timing issue, make sure the Fabric run script build phase is the last build phase and no other scripts have moved the dSYM from the location Xcode generated it. Unable to process FieldSense.app.dSYM at path /Users/dnb/Library/Developer/Xcode/DerivedData/myApp-ggomikgtclrabvaoqmbwhjyudhxy/Build/Products/Debug-iphonesimulator/myApp.app.dSYM
How to solve?
To solve this issue:
Go to your project settings
Select your target
Go to Build settings
Scroll down to Debug Information Format (make sure to choose All settings)
Set the values to DWARF with dSYM File

TwitterKit does not compile with Xcode 6.3

I added TwitterKit from Fabric to an app under Xcode 6.3.
The app would compile before I added TwitterKit's Run Script build phase step but once I added TwitterKit it failed with this error during Debug builds:
2015-02-23 11:22:32.382 run[53735:1513077] Fabric.framework/run 1.3.13
2015-02-23 11:22:32.388 run[53735:1513077]
Fabric: dSYM Error
Unable to process fabrictest.app.dSYM at path /Users/mfoouser/Library/Developer/Xcode/DerivedData/fabrictest/Build/Products/Debug-iphonesimulator/fabrictest.app.dSYM
Make sure your project build settings are generating a dSYM file. DEBUG_INFORMATION_FORMAT should be set to dwarf-with-dsym for all configurations. This could also be a timing issue, make sure the Fabric run script build phase is the last build phase and no other scripts have moved the dSYM from the location Xcode generated it.
Command /bin/sh failed with exit code 1
Anyone find a way around this?
This was a simple fix. Just do as the error state, turn on dSYM generation for your debug build.
Change your Build Settings from this:
To this:
Then choose Build again. It should now compile and run.
You can follow below steps ,it worked for me.
open build setting of your project and search for "Generate debug symbol" and set it to Yes.
As in the below screenshot
Search for debug information format in build setting and search for "Debug information format" then set "Debug information format" to "DWARF with dSYM file"
This didn't work for me since it was already set to 'with dSYM' and it didn't build as well. After more digging and trying things out, it seems like the issue (for me at least) is under Build Settings > Generate Debug Symbols, which was set to No by default. I changed it to Yes and it worked like a charm.
No one of proposed answers worked out for me.
Deleted both Fabric.framework and Crashlytics.framework which were added via Fabric app and added them again through Cocoapods.
**It doesnt mean that Cocoapods is only workaround, but probably that they should be re-added to project again.
What worked for me was the previous answers combined:
1- Change "Build Settings -> Debug Information Format -> Debug" value to "DWARF with dSYM File"
2- Change "Build Settings -> Generate Debug Symbols" value to "Yes"
3- Remove Fabric and Crashlytics frameworks and install again

Resources