Firebase Crashlytics iOS: Cannot receive events even though the script seems running - ios

I know this can be a seemingly frequently asked question, but I cannot receive events from Firebase Crashlytics.
Of course I searched around for the previously asked questions, but none was my case.
If someone has any idea other than the things I've done below, please let me know.
What I've done:
Checked the build script (${PODS_ROOT}/Fabric/run) is running. It leaves this kind of message on the log and nothing looks wrong. Also, when I faked the path or filename just for double-cheking the build stopped with a script not found error.
Running upload-symbols in Build Phase mode
Validating build environment for Crashlytics...
Validation succeeded. Exiting because upload-symbols was run in validation mode
Freshly downloaded GoogleService-Info.plist from the dashboard. This also looks like working because deleting or renaming this file gives me a build error(=file itself is recognized) and faking the bundle id inside the plist gives me a warning in the runtime(=file content is read). I believe this also eliminates the possibility that the event is being sent to somewhere else unexpectedly.
Detached from debugger when testing. I think this is what most of people have experienced. I made sure of this hundreds of times by doing kill -> relaunch -> crash -> relaunch many times.
Excluded crash testing code from launch process. This is also a common pitfall, and I of course wrote the crash code in a button event handler.

Note: For better debugging you should use the -FIRDebugEnabled flag in Arguments Passed On Launch. This worked for me:
1) Change your run script:
"${PODS_ROOT}/Fabric/run" -d
In your build output you should now see the API Key:
Running upload-symbols in Build Phase mode
Validating build environment for Crashlytics...
Arguments:
Debug mode enabled
API Key: <api-key>
Platform: ios
DSYM Paths: ["..."]
2) Manually initialize Crashlytics in your AppDelegate:
Crashlytics.start(withAPIKey: "<api-key>", delegate: self)
Launch the app, you should see the crashlytics output:
Crashlytics] Version 3.14.0 (144)
[Crashlytics] Running on iOS Simulator (iPhone), 13.1.0 (19A602)
[Fabric] settings downloaded successfully
[Fabric] Settings are available for consumption
3) Perform a crash (with debugger detached). After this you should see this output:
[Crashlytics:Crash] report submission successful

Related

Xcode 14 is not getting attached to Simulator in Debug mode

While debugging any iOS application, Xcode builds and run successfully, also launches a simulator but it is not able to attach debugger from Xcode 14 to Simulator iOS app.
It throws an error in Xcode:
Xcode console says:
Could not attach to pid : “75997” Domain: IDEDebugSessionErrorDomain
Code: 3 Failure Reason: attach failed (Not allowed to attach to
process. Look in the console messages (Console.app), near the
debugserver entries, when the attach failed. The subsystem that
denied the attach permission will likely have logged an informative
message about why it was denied.) User Info: {
DVTRadarComponentKey = 855031;
IDERunOperationFailingWorker = DBGLLDBLauncher;
RawUnderlyingErrorMessage = "attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the
debugserver entries, when the attach failed. The subsystem that
denied the attach permission will likely have logged an informative
message about why it was denied.)"; }
Tried with re-installing Xcode and Command line tools, but issue persists.
Steps:
Build and run app with Debug executables true
Simulator gets launched
Error on Xcode and it gets disconnected from simulator
Is there a possibility that it can be blocked by any other app, if so how to identify ?
I solved the issue by doing the steps below:
SOLUTION 1:
Edit the scheme
Select Run
Select Build Configuration "Debug"
Select "Wait for the executable to be launched"
Close
Run the app
see the screenshot here
You will receive an error message when you run the app again.
Close the app.
Edit the scheme again and change "Wait for the executable to be launched" to "Automatically".
Now your simulator will work as expected.
SOLUTION 2:
Delete your app folder in Derived Data
/Users/[your username]/Library/Developer/Xcode/DerivedData/
Search your app name folders and delete them.
SOLUTION 3:
Open the terminal and run:
sudo DevToolsSecurity -enable
This command enables the Developer Mode. After running the command you will receive this message: [Developer mode is now enabled].
Sometimes it's happen, when you are trying to build too fast after a build has started.
First of all, quit your current simulator, delete derived data and clean the project, wait until whole processing is complete. Then do some changes / editing if required (as we clean all data) and try running on a different simulator.
Check certificates in key-chain access, if you found any untrusted certificates in key-chain access remove it.
Also if you are using beta version just make sure it is downloaded from Apple official website.
Came here to share my (strange) solution if anybody crosses the same problem with no answers working. In my case, no solution from this nor other SO answers to similar questions worked (cleaning, rebuilding project, updating, clearing derived data..)
My setup is:
Macbook M1 2022 + Xcode Version 14.2 (14C18)
This Xcode version could not attach to any of my apps (fresh new or previously developed) on different simulators (11, 12, 14) with iOS versions 13.7 - 16.2.
Editing scheme solution from answer above was not working also so I ended up in leaving scheme as:
Build configuration: Release
Debug executable Deselected(!)
Launch Automatically
And magically debugging app in Xcode started working even though it's release version with debug option deselected.. Selecting Debug executable again makes Xcode not possible in attaching to app process
Just to clarify: above steps actually makes app to run as in DEBUG mode - Xcode attaches to pid, I can do console logs and breakpoints. This Xcode version behaves opposite than options selected

The request was denied by service delegate (SBMainWorkspace) on iOS 10.0+ simulator & FBSOpenApplicationErrorDomain error 1 on iOS 9.3 simulator. Why?

When trying to run any of the projects that I usually run I'm getting the following errors for different simulators:
The request was denied by service delegate (SBMainWorkspace) for reason: unspecified on iOS 10.0+ simulator
The operation could not be completed (FBSOpenApplicationErrorDomain error 1) on iOS 9.3 simulator.
This issue began when I tried installing a previous version of Xcode 8.2.1 from what I had been using (8.3). I couldn't build any projects in the 8.2.1, but I could still build in 8.3. I named the 8.2.1 a different name in order to be able to run them side by side. This was something I had done before. However, I needed 8.2.1 for a project and so I deleted both and then reinstalled just 8.2.1 according to this post: How to Completely Uninstall Xcode and Clear All Settings.
I've checked the scheme settings in Product > Scheme > Edit scheme > Run > Environment Variables and I've made sure there are no empty environment variables checked. I don't have any environment variables at all now.
I've reset content and settings on the simulators.
I've created a new simulator of a different iOS version. Originally I was just trying on 9.3 and 10.3. I then downloaded the 10.0 and 10.2 and still have the same issue occurring.
I consistently clean my project before running, both (shift + cmd + K) and (shift + alt/option + cmd + K).
I've rebooted my system. I've done everything I can think of. The issue still prevails. What am I missing?!
FBSOpenApplicationErrorDomain error 1, "unspecified" is a catch-all error code for something going wrong during launch that wasn't covered by another error code. There are a couple possible causes for this error code, and it is unfortunate that they do not get displayed in the UI.
I suggest you look in the simulated device's system log to uncover the real cause for the failure. Run this to see all the logs from CoreSimulatorBridge as that logs the full error when it gets it:
xcrun simctl spawn booted log show --info --debug --predicate 'processImagePath contains "CoreSimulatorBridge"'
If that isn't descriptive enough, you might want to also look at the logs for SpringBoard or assertiond, or just use --start and --end to see all the logs for the relevant time range.

Calabash-ios: Run test physical device installed ipa without xcodeproj

I am new with calabash-ios and have a dummy question is:
How possibly could I run a calabash test with real device which have installed ipa file (included calabash framework) and without xcodeproj?
Problem is I am doing QA and Dev only gives me ipa file to test without source code.
UPDATE:
I am able to run the ipa file in console and cucumber by adding BUNDLE_ID. And make sure the CFNetwork.framework is including in app framework to establish the connection.
But I got another problem to run the scenario:
1. When I run the command below:
DEVICE_ENDPOINT=http://192.168.1.9:37265 NO_LAUNCH=1 BUNDLE_ID=com.example.appname DEVICE_TARGET=UDID cucumber
Then I got this error:
A JSON text must at least contain two octets! (JSON::ParserError)
features/my_first.feature:8:in `Then I touch "LOG-IN/ CREATE ACCOUNT"'
all other steps was skipped
Then I run the console code
DEVICE_ENDPOINT=http://192.168.1.9:37265 NO_LAUNCH=1 BUNDLE_ID=com.example.appname DEVICE_TARGET=UDID calabash-ios console
Then I run server_version
I got reply back that said connection SUCCEED
But when I run start_test_server_in_background
It took me too long to wait and I see the app my physical device kept crashed and launch again and again until it stop as:
Unable to start. Make sure you've set APP_BUNDLE_PATH to a build supported by this simulator version
Calabash::Cucumber::Launcher::StartError: Calabash::Cucumber::Launcher::StartError:
"Timed out waiting for UIAutomation run-loop Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError.
2015-10-01 10:49:41.634 instruments[15640:10558880] WebKit Threading Violation - initial use of WebKit from a secondary thread.
2015-10-01 10:49:42.574 instruments[15640:10558978] Attempting to change event horizon while disengage
2015-10-01 10:49:42.577 instruments[15640:10558877] Attempting to change event horizon while disengage
Instruments Trace Error : Target failed to run: Permission to debug app
Anyone can help please! I tried to search some solution but they almost issue on simulator and they contain xcodeproj. As a QA, I dont have the source code, only .ipa file. :(
Thanks
You should set 3 variables:
$ DEVICE_TARGET=<UDID> \
DEVICE_ENDPOINT=http://<ip>:37265 \
BUNDLE_ID=com.example.YourApp cucumber
The device and the host computer should be on the same network.
The .ipa must be installed on your device.
You can do this in Xcode by dragging-and-dropping in the Device Manager window or with a third-party tool like ideviceinstaller (available with homebrew).
You should never set NO_LAUNCH.
http://calabashapi.xamarin.com/ios/file.ENVIRONMENT_VARIABLES.html#label-NO_LAUNCH
You also need to enable you device for develop and turn on UIAutomation in the Settings.app > Developer.
Enabling device for development
RunLoop::Fifo::NoReaderConfiguredError
UPDATE In response to this question, I rewrote the Testing on Physical Devices Calabash iOS wiki page. Wow, that content was ancient!
As long as the file is build with calabash then that is not a problem. You just call cucumber with APP_BUNDLE_PATH to where ever your .ipa file is and should be all set.
But you should be aware that .ipa needs to be build to match the target you run the tests on.

Crashlytics not uploading symbols in "Archive" mode

I managed to setup Crashlytics for an iOS app
Added ./Crashlytics.framework/run <uuid> as a post build step
Then my code uses [Crashlytics startWithAPIKey:<uuid> at startup.
So far it works works.
But since I have a script that changes the CFBundleVersion automatically for every single build, I decided to disable Crashlytics for debug builds, to avoid being spammed by development versions.
I followed these guidlines from the help pages, and changed my script to
releaseConfig="Release"
if [ "$releaseConfig" = "${CONFIGURATION}" ]; then
echo "Running Crashlytics"
./Crashlytics.framework/run {your_api_key_here}
fi
It works. The script only runs only when I use the "Archive" mode of Xcode 5, which is doing release builds.
However, unless I make a normal "Build", the version I archived does not appear in the Crashlytics dashboard, even when I make it crash with [Crashlytics crash] and wait for hours... But if I make a normal "Build" with the same CFBundleVersion, then suddenly my build appears in the dashboard, with all the crashes against the release build. (I know because I report the fact it's a release build with custom keys).
What so different between the "Archive" and "Build" mode? Is this a bug? Has any body managed to make a similar setup work with Crashlytics? What am I missing here?
I know this is an old question, but FYI, the scheme determines the configuration that gets built when archiving. Check your scheme and make sure it's building the "Release" configuration.

UIAutomation script not running on device

For some reason, UIAutomation doesn't want to run on my physical device. I've gotten to run once, but otherwise when I kick it off, it simply sits there reporting "Script has stopped".
I've checked the following:
Using a developer profile to code sign
Several different cables, including a first party Apple one
Restarting my Mac and the iPad
Cleaning and rebuilding
Other instruments work just fine, I can run allocations and leaks without any issue, automation just refuses to run.
I had the same problem and then (eventually) figured it out.
Turns out the build has to be a DEBUG build so that instruments can attach to it. I edited the scheme build settings for "build for profiling" so that it would build a DEBUG build rather than a RELEASE build and things started working.

Resources