Created
November 24, 2013 12:57
-
-
Save jiro/7626999 to your computer and use it in GitHub Desktop.
This script changes base urls of api for debbuging on iOS devices.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ "${CONFIGURATION}" == "Debug" && "${PLATFORM_NAME}" != *simulator* ]]; then | |
plist="${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}" | |
ip=$(ifconfig en0 | grep "inet[^6]" | cut -d" " -f2) | |
url=$(/usr/libexec/PlistBuddy -c "Print :APIBaseURL" $plist) | |
url=$(echo $url | sed "s|\(http://\)[^:/]*\(.*\)|\1$ip\2|") | |
/usr/libexec/PlistBuddy -c "Set :APIBaseURL $url" $plist | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *baseURLString = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"APIBaseURL"]; | |
NSURL *baseURL = [NSURL URLWithString:baseURLString]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment