Crashlytics not uploading symbols in "Archive" mode - ios

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.

Related

Xcode debug build vs release build

I am currently building a react native app using expo.
However, I needed to use cocoapods, which is why I am now using Xcode.
Since I have switched to Xcode, there has been a difference between my local debugging builds (that I run to a USB connected iPhone) vs the builds that get pushed to TestFlight.
After doing some digging I have found that it may be due to the debug vs release schemes in Xcode.
From what I've see it seems that the difference should really just be in performance, file sizes, and some other aspects, but not what the app actually does and displays like in my case.
To test, I made a change on my app's homepage to simply have the text, UPDATED.
As expected, when ran with the debug scheme, the UPDATED text shows up, but when ran with the release scheme, it does not.
How do I get these to sync up and have the release build recognize the changes I make as I am certain I do not want to push a debug build to the app store?
Things I have tried:
Removing/cleaning Build folder and rebuilding
Updating Xcode
Running on another device
Building/running with expo (this did something, but it just causes the app to crash, assuming it is because of the cocoapods)
Versions:
react-native: 0.61.5
Xcode: 11.4.1
macOS: 10.15.3
Thank you
I have fixed the issue.
I found that by running expo publish in the terminal and then building with the release archive scheme in Xcode, it notices the changes.
Now why that is required (maybe it isn't), I am unsure of.
If anyone has an any additional insight, it would be greatly appreciated.
EDIT: So it looks like when I run expo publish it updates the app.bundle and app.manifest. This must be what the release scheme looks at when building.

How does Xcode server run tests in release mode without Enable Testability?

When using Xcode server to execute UI Tests, the bot has a setting to 'override' the configuration to Release mode.
This was handy as tests would be executed on release build.
Now when I am trying to run tests on TeamCity or CLI and pass the -configuration Release I get an error saying Module 'App name' was not compiled for testing
This can be solved by toggling Enable testability flag for Release configuration in build settings but that will have to be changed back each time before releasing the app.
Creating another build configuration is also not a desirable option as I have a lot of targets and maintaining an extra config for all would be a pain.
So how does Xcode server do this? Is there a CLI param or something I am missing? Or does it just change the setting via a prebuild script?

Xcode Server Bot Issue: warning. Build Service Error. Issue: archive at path 'some/path' is malformed

I'm using Cocoapods and KIF to run Continuous Integration on an Xcode server. I have successfully set this up for one project to report on each commit. I'm now using a second project and get the error:
Bot Issue: warning. Build Service Error.
Issue: archive at path '/Library/Developer/XcodeServer/Integrations/Integration-81d42936b22a04037fd4aebed1074e5e/Archive.xcarchive' is malformed.
Integration Number: 1.
Description: archive at path '/Library/Developer/XcodeServer/Integrations/Integration-81d42936b22a04037fd4aebed1074e5e/Archive.xcarchive' is malformed.
The tests passed when ran on the Xcode server machine using Xcode. I tried downloading Provisioning Profiles etc via Xcode but that didn't help. I deleted the Bot and created a new one but that also did't help.
Any help is welcome
At least in my case (and there may be multiple causes), this was caused by having "Skip Install" set on every target, which causes you to end up with an empty archive (but only on Xcode Server).
Basically, xcodebuild (the command-line tool) has lots of critical differences from Xcode in the way it handles archiving. It builds targets that aren't listed in the scheme, and it obeys the Skip Archive flag even for targets listed in the scheme. By contrast, when building locally, Xcode ignores the Skip Archive flag and archives any targets in the scheme (and only the targets listed in the scheme).
I would encourage you to file a bug every time you run into situations where a project builds locally but fails on the server. If everyone did this, perhaps these differences would eventually get fixed....

Is it possible to set up Crashlytics on iOS without having to install the app on each developer's workstation?

Crashlytics looks like the best crash reporting solution on iOS, but app is noisy and it dirties commits.
Since our Ad-Hoc and App-Store builds come from a CI server we don't need each developer's workstation to upload .dSYM files to the server.
Is it possible to configure it so that only the CI server has to deal with Crashlytics?
We do this in our Run Script phase:
if [ ${CONFIGURATION} == "Release" ]
then
./Fabric.framework/run <magic> <number>
fi
That way, devs use the Debug build normally, but if they want a production-ready build then they can do one.
If you really want it to be only for your CI build, then you can pass additional variables on the xcodebuild command line, call it something like USE_CRASHLYTICS and otherwise it's the same.
Nope. You'll have to have each developer install it. It's the same principle with anything with Cocoapods. Just because a project has pods on it doesn't mean that when another developer pulls it from Git they too have access to the pods.

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