How to stop Fabric from running - ios

I've went through documentation: http://support.crashlytics.com
It doesn't seem to question the purpose of the app, so I will ask here :)
I have Fabric integrated in my app. As per installation process, I've installed Fabric app on the Mac I am working on.
Now, from time to time, I have Fabric app that keeps opening, which I personally find very annoying. It's too much for a 3rd party service (even for a great one as Fabric Analytics).
In the build steps in Xcode I've found a script, but doesn't seem that it does the thing:
#!/bin/sh
# run
#
# Copyright (c) 2015 Crashlytics. All rights reserved.
# Figure out where we're being called from
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# Quote path in case of spaces or special chars
DIR="\"${DIR}"
PATH_SEP="/"
VALIDATE_COMMAND="uploadDSYM\" $# validate run-script"
UPLOAD_COMMAND="uploadDSYM\" $# run-script"
# Ensure params are as expected, run in sync mode to validate
eval $DIR$PATH_SEP$VALIDATE_COMMAND
return_code=$?
if [[ $return_code != 0 ]]; then
exit $return_code
fi
# Verification passed, upload dSYM in background to prevent Xcode from waiting
# Note: Validation is performed again before upload.
# Output can still be found in Console.app
eval $DIR$PATH_SEP$UPLOAD_COMMAND > /dev/null 2>&1 &
So what is Fabric App is really for? Can it be excluded from the workflow? Can I actually erase it and continue the management through Pods? What's the trick behind it?

Because this question is still relevant, to prevent Fabric from launching, you got two options:
1. Stop it after uploading your project’s DSYM file.
Open up the run script: Pods/Fabric/run and change:
eval $DIR$PATH_SEP$UPLOAD_COMMAND > /dev/null 2>&1 &
To:
eval $DIR$PATH_SEP$UPLOAD_COMMAND;killall Fabric > /dev/null 2>&1 &
2. Stop it and only upload DSYM when archiving builds for release:
Check the “Run script only when installing” option under Build Phases:

Related

Is there a way to share Xcode templates across a team?

At work, we've been moving towards a VIPER based architecture, so I have written an Xcode template for creating and instantiating all the required files which works perfectly for what we need.
I have pasted it ~/Library/Developer/Xcode/Templates, and it works and shows up fine, however I've been asked to look into if it was possible to have it synced across the team instead of having to email it to everyone whenever there is a change, or reuploading to Confluence and having everyone redownload and reinstall it. Now, I've looked online, but I am unable to see anything of much help about syncing them across team members, so I just thought I'd ask if you guys know of a way?
Thanks a million guys
I have the same thing on my project and all I did was to add the template files on the source control (into a separated folder) and write a shell script to install/uninstall the templates:
Note that it uses symlink so any updates will propagate.
#!/usr/bin/env bash
set -eo pipefail
# Default the folder name to "Project Name".
folderName="Project name that will show under Xcode Menu"
scriptPath="$( cd "$(dirname "$0")" ; pwd -P )"
xcodeTemplateDirectory=~/Library/Developer/Xcode/Templates/File\ Templates/
linkName="$xcodeTemplateDirectory"/"$folderName"
if [ $1 == "install" ]; then
# Create the install directory if it does not exist.
if [ ! -d "$xcodeTemplateDirectory" ]; then
mkdir -p "$xcodeTemplateDirectory"
fi
rm -rf "$linkName"
ln -s "$scriptPath"/"$folderName" "$xcodeTemplateDirectory"
fi
if [ $1 == "uninstall" ]; then
rm -rf "$linkName"
fi

IOS upload symbol files for crash reporting fail

/Users/appledev018/LarsonApp/Pods/FirebaseCrash/upload-sym-util.bash:335: error: curl exited with non-zero status 35.
hello
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
I follow the guide to set up firebase crash reporting and when I run my project get above error
and following is my script
echo "### hello world"
GOOGLE_APP_ID=1:688585241582:ios:0203552cad37c112
echo "### hello google"
"${PODS_ROOT}"/FirebaseCrash/upload-sym "${PROJECT_DIR}/ServiceAccount.json"
echo "### hello"
Enable "Run Script only when install" in build phases. Then it'll run as expected. This will avoid to upload the script each time when run the system.
Please refer attached screen shot.
If you have bitcode enabled, you can use this script to automate the process and not worry about the rest.
Follow these steps carefully
Add your unzipped dsym folder to your project's main directory
Add this script to the dsym folder
Open terminal
cd into the dsym folder in the project's main directory
Run this python script i.e 'python batch_upload_files.py'
https://github.com/hanijazzar/Contributions/blob/master/batch_upload_files.py
Maybe I am a bit late, but here is a solution.
The problem is that curl can not verify the SSL certificate on the remote server and therefore blocks the transfer because it seems to be insecure.
You have 2 options:
1) Add -k as an option to the curl call. (This means to edit the script in the pod.)
2) Allow insecure SSL connections generally. (This disables certificate chain checking but leaves other validation enabled.)
$ echo insecure >> ~/.curlrc

Parse Crash Reporting - Script Does not End

I just enabled ParseCrashReporting in my app, and now when I build the app, Xcode stays on "Running 2 of 2 custom shell scripts" (i have another simple script for HockeyApp integration, placing it before that does not change anything).
My script is below:
export PATH=/usr/local/bin:$PATH
cd ~/OneDrive/AppName
parse symbols AppName -p "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
My AppName folder is also where I started my parse cloud repo, it contains the folders cloud, config and public. I tried changing the path to AppName/cloud but no change.
Xcode stays running that script for a long time...i've waited 10 minutes for it before and it doesn't continue beyond that. Once I stop the build, I get an error: Shell script invocation error:
Uploading iOS symbol files...
Command /bin/sh failed with exit code 1
I assume the error just shows because I cancel the task. Why would this be sticking like so? I have looked at several questions on parse crash reporting and have not seen any similar issues.
Just use the following script instead, I just tested it and it works:
echo "Parse Crash Reporting"
export PATH=/usr/local/bin:$PATH
CLOUD_CODE_DIR=${PROJECT_DIR}/helloKittyAdventureTimeCloudCodeFolder
if [ -d ${CLOUD_CODE_DIR} ]; then
cd ${CLOUD_CODE_DIR}
parse symbols YOUR_PARSE_APP_NAME --path="${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
echo "Finished uploading symbol"
else
echo "Unable to upload symbols"
fi
IMPORTANT:
The following line needs to be changed based on your folder name, that's it, keep everything else the same:
CLOUD_CODE_DIR=${PROJECT_DIR}/helloKittyAdventureTimeCloudCodeFolder <===this should be the
name or your own folder!!, so, if your folder is named theAdventuresOfCaptainCookCloudCode,
then you would type this:
CLOUD_CODE_DIR=${PROJECT_DIR}/theAdventuresOfCaptainCookCloudCode
Also, one more thing to note, you don't need the echos and such if your run this as a Run Script in Xcode, but you don't have to take them out either, you can just run it like this and you won't have a build error.
One more thing, make sure to change YOUR_PARSE_APP_NAME to the name or your app, sorry about that, this also needs to be changed

Register for messages from collabd like XCSBuildService to receive Xcode Bots integration number

During an Xcode Bots build each run gets an integration number assigned. This number does not show in the build logs but would be convenient to create http links back to the individual Xcode Bots build in an CI environment or enterprise app store.
In the /Library/Server/Xcode/Logs/xcsbuildd.log I found that XCSBuildService gets a message/event from collabd with a structure that contains the integration number.
Is there a way to register to the same event in an own (OSX) program and receive this message/event?
The only ugly way I found so far to get the Xcode Bots integration number was by parsing the xcsbuildd.log file with the drawback that I can't be sure that the latest integration number corresponds with my current build when several builds are executing in parallel.
This log file is also located in an read protected folder/file so that I have to either change the permissions (ugh!) or use sudo (I don't really want to do that)!?
Example:
sudo grep -r "integration =" /Library/Server/Xcode/Logs/xcsbuildd.log | tail -1 | cut -d'=' -f 2| cut -d';' -f 1 |tr -d '\040\011\012\015'
Gives me the latest integration number stripped from whitespace ...
Edit:
Just found out that if you actually include the following script in your scheme as Build-post-action it will create a file (e.g. /Library/Server/Xcode/Data/BotRuns/Cache/22016b1e-2f91-4757-b3b8-322233e87587/source/integration_number.txt) with the integration number without requiring sudo. Xcode Bots seems to serialize the different builds so that they are not executed in parallel and so the created integration number in the file could be used.
grep -r "integration =" /Library/Server/Xcode/Logs/xcsbuildd.log | tail -1 | cut -d'=' -f 2| cut -d';' -f 1 |tr -d '\040\011\012\015' > ${PROJECT_DIR}/integration_number.txt
For specifically the case of getting the integration build number, I've added a simple answer here.
To repeat myself (and keep this from being down voted as a 1-line answer):
I implemented this using a Shell Script Build Phase in my Xcode project. In my case, I used the integration number to set the internal version of my built product. My script looks like this:
if [ "the$XCS_INTEGRATION_NUMBER" == "the" ]; then
echo "Not an integration build…"
xcrun agvtool new-version "10.13"
else
echo "Setting integration build number: $XCS_INTEGRATION_NUMBER"
xcrun agvtool new-version "$XCS_INTEGRATION_NUMBER"
fi
Note that XCS_INTEGRATION_NUMBER exists by default in the Xcode Server build environment. If you want to simulate an integration build (for the purposes of this script), you can simply add it to your build settings as a custom variable.

Xcode 5 bots and Testflight automated builds

First I have a Mac Mini running Server on Mavericks and have Xcode 5 installed. On the server I have my iOS projects set up with Bots to run automated builds of my Github repo on each commit to master. What I want to find out is if anyone already has configure this kind of setup to work with automated builds being sent to TestFlight.
The script that worked previously with a Jenkins build process is pasted below, but throws an error and doesn't upload when the bot completes it's build. I have this script run on the "post-action" of the archive process of my app.
Server log error:
Print: Entry, "CFBundleVersion", Does Not Exist
error: Specified application doesn't exist or isn't a bundle directory : '/Library/Server/Xcode/Data/BotRuns/Cache/s892fj1n2-f4bb-2514-522v-2a23d0f0c725/DerivedData/Build/Products/Debug-iphoneos/myApp.ipa'
Script:
PLIST_FILE=$(echo -n "${SRCROOT}/${INFOPLIST_FILE}")
BUILD_TYPE=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PLIST_FILE}")
API_TOKEN="<API_TOKEN>"
TEAM_TOKEN="<SECRET>"
APP="${BUILD_ROOT}/Debug-iphoneos/${FULL_PRODUCT_NAME}"
/bin/rm "/bots/${PRODUCT_NAME}.ipa"
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "${APP}" -o "/bots/${PRODUCT_NAME}.ipa"
/usr/bin/curl "http://testflightapp.com/api/builds.json" \
-F file=#"/bots/${PRODUCT_NAME}.ipa" \
-F a pi_token="${API_TOKEN}" \
-F team_token="${TEAM_TOKEN}" \
-F notes="Build uploaded automatically from server." \
-F distribution_lists="internal"
UPDATE 11/20:
A good resource to try:
TestFlight Bots
I didn't get it to work a couple weeks ago but the post has been updated since I last tried.
This looks like a permissions issue. Are you able to access \Library\XCode\Data folder? I was able to run your script (other than upload to testflight). I had to give read access to \Data and write access to destination folder and I see the ipa created.
I am researching ways to switch my team from our Jenkins farm for iOS builds to the new Xcode bots server. I have a very similar problem to solve regarding continuous deployment upon a successful CI build/test.
I don't have an answer (yet), but, wanted to share some things I found that may help you.
Two threads may help give clues to why your TestFlight upload is failing on the bots server.
According to Kra Larivain with this post regarding the CocoaPods CLI and Xcode bots:
"the build runs on the bot as an unprivileged user with no shell (_teamsserver with /usr/bin/false as a shell)"
"add _teamsserver to the password-less sudoers (%_teamsserver ALL=(ALL) NOPASSWD: ALL in your sudoers file). You probably want to be a little bit more clever and only grant it sudo privilege" for the commands actually needed
/Library/Server/Xcode/Data is set to be rw by the _teamsserver user only
"add to your pre action the following script, where BUILD_USER is your, well, build user. Make sure you Provide build settings from the main target, SRCROOT won’t be set otherwise (the default is None)." This example is for CocoaPods, but, could be adapted to your use
if [ `whoami` = '_teamsserver' ]; then
echo "running pod install as part of CI build"
chmod 777 /Library/Server/Xcode/Data
cd ${SRCROOT}
rm ./Podfile.lock
rm -rf ./Pods
sudo chown -R BUILD_USER .
sudo -H -u BUILD_USER pod install
sudo chown -R _teamsserver .
fi
You likely seen this already, but, it's worth mentioning for others. Check Justin Miller's post on Xcode and testflight post-archive actions for comparison with your script.
Good luck!
Steve

Resources