Skip to content

Instantly share code, notes, and snippets.

View behdaad's full-sized avatar
👻
Boo!

behdad behdaad

👻
Boo!
View GitHub Profile
@behdaad
behdaad / ios-gitlab-ci.yml
Last active May 30, 2021 17:31
GitLab CI/CD for Xcode Projects/Workspaces
variables:
GIT_STRATEGY: fetch
DEBUG_SCHEME: Debug
PRODUCTION_SCHEME: Production
stages:
- test
- danger
- archive
@behdaad
behdaad / firebase-iOS-breakdown
Created September 26, 2020 15:56 — forked from zntfdr/firebase-iOS-breakdown.swift
Firebase iOS Version breakdown
// How to:
// 1. Go in the Firebase Analytics Dashboard
// 2. Filter iOS Platform only
// 3. Scroll down, select `Device` under the "What is your audience like?" widget
// 4. Export the CSV data (top right of the corner, there's a `...` menu with Download CSV option)
// 5. Open the file and select the iOS breakdown raw data
// 6. Replace your data with the sample data in this script
// 7. Run the script in a Xcode Playground
// 8. See the terminal output

git log --oneline master...rc

let maxBeers = 99
var beers = maxBeers
while beers >= 0 {
switch beers {
case 0:
print("No more bottles of beer on the wall, no more bottles of beer. ")
print("Go to the store and buy some more, \(maxBeers) bottles of beer on the wall.")
case 1:
print("1 bottle of beer on the wall, 1 bottle of beer.")
@behdaad
behdaad / devices.js
Created January 2, 2020 11:29
Export device list from Apple Developer panel
var data = document.querySelectorAll(".infinite-scroll-component .row");
var csvOutput = "Name, Identifier, Type\n"
for (var i = 1; i < data.length; i++) {
let name = data[i].childNodes[0].childNodes[0].textContent;
let identifier = data[i].childNodes[1].childNodes[0].textContent;
let type = data[i].childNodes[2].childNodes[0].textContent;
let device = [name, identifier, type].join(", ") + "\n";
csvOutput += device;
}
Snippets
hexdump -C -n128 myfile.ext
security find-identity -v -p codesigning
codesign -d --entitlements :- Snapp.app
cd ~/Library/MobileDevice/Provisioning\ Profiles/
security cms -D -i xxxxxxxx_your_pp_id.mobileprovision
@behdaad
behdaad / iPhone.md
Created May 9, 2019 05:37
iPhone charging problem

sudo killall -STOP -c usbd

@behdaad
behdaad / export.md
Last active March 23, 2019 15:26
Export IPA from Archive w/o Developer Account
  1. Just build (Command+B) your app from Xcode by setting proper code signing identities
  2. From Xcode's file search at left bottom, search for .app (This will be under product directory)
  3. Right Click on this .app file and select Show in Finder
  4. Now, create directory and name it as Payload, copy .app into Payload directory.
  5. Archive/Compress(.zip) this Payload directory, rename file extension from .zip to .ipa
  • Create Archive
  • Go to Organizer
  • Get location of Archive by Right Click and selecting Show in Finder
@behdaad
behdaad / resign.sh
Created March 23, 2019 15:15
Resign IPA file
IPA="/path/to/file.ipa"
PROVISION="/path/to/file.mobileprovision"
CERTIFICATE="Name of certificate: To sign with" # must be in keychain
# unzip the ipa
unzip -q "$IPA"
# remove the signature
rm -rf Payload/*.app/_CodeSignature Payload/*.app/CodeResources
# replace the provision
cp "$PROVISION" Payload/*.app/embedded.mobileprovision
# sign with the new certificate
@behdaad
behdaad / instruments.md
Created March 22, 2019 21:19
Use Xcode Instruments for iOS apps from App Store, without jailbreak
  1. Turn off SIP so you can debug Instruments.app
  2. lldb -n Instruments
  3. put a breakpoint on - [XRRemoteDevice launchProcess:suspended:error:]
  4. select target device and apps, perform the task that you are interested in
  5. when the breakpoint is hit, reg write rcx 0 (override 3rd argument to false)
  6. continue