Quickies

[categories] [index] [all (531)] [latest]

iOS
  1. $ echo "0x28 0x46" | llvm-mc --disassemble -triple=thumbv7
        .text
        mov r0, r5
    
    $ echo "mov r0, r5" | llvm-mc -assemble -triple=thumbv7 -show-encoding
        .text
        mov r0, r5                  @ encoding: [0x28,0x46]
    
    $ echo "movs r0, 0x1" | llvm-mc -assemble -triple=thumbv7 -show-encoding
        .text
        movs    r0, #1                  @ encoding: [0x01,0x20]
    

    See also iOS binary patching: http://www.zdziarski.com/blog/?p=2172

    1. take a screenshot with cmd-alt-4-space
    2. open it in Acorn
    3. go to menu Image > Crop
    4. from 47 151
    5. size 320 460
  2. from PIL import Image
    
    LEFT = 38
    TOP = 146
    WIDTH = 320
    HEIGHT = 460
    
    img = Image.open('sc.png')
    box = (LEFT, TOP, LEFT+WIDTH, TOP+HEIGHT)
    area = img.crop(box)
    
    area.save('sc2.png')
    
  3. #import <QuartzCore/QuartzCore.h>
    ...
    view.layer.borderColor = [UIColor blackColor].CGColor;
    view.layer.borderWidth = 1;
    
  4. $ rvictl -s UDID
    $ sudo launchctl list com.apple.rpmuxd
    $ sudo tcpdump -n -t -i rvi0 -q tcp
    
  5. $ codesign -d --entitlements - MyApp.app
    

    the result should include:

    <key>aps-environment</key>
    <string>production</string>
    
  6. With an iPhone, dial and call:

    *3001#12345#*
    
  7. Add them into scheme > arguments

    -AppleLanguages (de)
    -AppleLocale fr_FR
    
  8. po [[[UIApplication sharedApplication] keyWindow] recursiveDescription]
    
  9. #if os(iOS)
    #elseif os(tvOS)
    #else
    #endif
    
  10. $ export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    $ codesign -fs "MyName" MyBinary
    
  11. if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ) {
        // ...
    }
    
  12. xcrun simctl io booted recordVideo movie.mp4