May 15, 2017 | MARIN USALJ Used by exec() family of functions (execve on OSX) Launching binaries, scripts with #! In C-family of languages, main(argc, argv) Process Arguments
May 15, 2017 | MARIN USALJ There are a number of options that can be passed into a target’s scheme to enable useful debugging behavior, but like a fast food secret menu, they’re obscure and widely unknown. MATTT THOMPSON, NSHIPSTER
May 15, 2017 | MARIN USALJ In most programming environments, you handle arguments by yourself Bash: getopt, getopts Ruby: OptionParser (and n^2345 others) How does this work?
May 15, 2017 | MARIN USALJ In most programming environments, you handle arguments by yourself Bash: getopt, getopts Ruby: OptionParser (and n^2345 others) Python: argparse How does this work?
May 15, 2017 | MARIN USALJ Arguments are parsed by Cocoa Injected on top of NSUserDefaults No need to store a value into NSUserDefaults to read it from args Parsing in Cocoa
May 15, 2017 | MARIN USALJ Arguments are parsed by Cocoa Injected on top of NSUserDefaults No need to store a value into NSUserDefaults to read it from args Anything stored in NSUserDefaults can be overridden Parsing in Cocoa
May 15, 2017 | MARIN USALJ Recompile the app with hardcoded server address Given each compilation is ~5 minutes, this would waste at least 50 CI minutes for each developer push. Recompile?
May 15, 2017 | MARIN USALJ Inject a file in the bundle after compilation Almost a viable solution, requires adding specific code for reading the bundle and overriding our servers. Inject a file?
May 15, 2017 | MARIN USALJ Launch the app with arguments overriding server endpoints Challenge: server environment stored as a nested Dictionary More than one endpoint to override (analytics for example) Launch arguments?
May 15, 2017 | MARIN USALJ $ lyft -servers 'yolo' Built in XML reader 1. Try to parse XML from 'yolo' 2. Try to parse Plist from 'yolo' 3. Just String('yolo')
May 15, 2017 | MARIN USALJ $ lyft -servers 'yolo' Built in XML reader 1. Try to parse XML from 'yolo' 2. Try to parse Plist from 'yolo' 3. Just String('yolo')
May 15, 2017 | MARIN USALJ $ lyft -servers 'yolo' Built in XML reader 1. Try to parse XML from 'yolo' 2. Try to parse Plist from 'yolo' 3. Just String('yolo')
May 15, 2017 | MARIN USALJ Overwriting values after launch won't work after app launch Watch out on places where you're reading / writing to NSUserDefaults Gotchas
May 15, 2017 | MARIN USALJ /*! -integerForKey: is equivalent to -objectForKey:, except that it converts the returned value to an NSInteger. If the value is an NSNumber, the result of - integerValue will be returned. If the value is an NSString, it will be converted to NSInteger if possible. If the value is a boolean, it will be converted to either 1 for YES or 0 for NO. If the value is absent or can't be converted to an integer, 0 will be returned. */ Gotchas
May 15, 2017 | MARIN USALJ XML tags CoreFoundation type XML Tag Storage format CFString UTF-8 encoded string CFNumber , Decimal string CFBoolean , No data (tag only) CFDate ISO 8601 formatted string CFData Base64 encoded data CFArray Can contain any number of child elements CFDictionary Alternating tags and plist element tags