Last active
January 14, 2016 23:42
-
-
Save mxpr/ff29b55242e81873f83d to your computer and use it in GitHub Desktop.
watchkit command line builds
This file contains 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
import plistlib | |
# Read Plists | |
myAppInfoPlist = plistlib.readPlist(“MyApp/Info.plist”) | |
watchKitExtensionInfoPlist = plistlib.readPlist(“WatchKitExtension/Info.plist”) | |
watchKitAppInfoPlist = plistlib.readPlist(“WatchKitApp/Info.plist”) | |
# Update Watch Kit Extension Plist | |
watchKitExtensionInfoPlist[“NSExtension”][“NSExtensionAttributes”][“WKAppBundleIdentifier”] = watchKitAppInfoPlist[“CFBundleIdentifier”] | |
watchKitExtensionInfoPlist[“CFBundleVersion”] = myAppInfoPlist[“CFBundleVersion”] | |
WatchKitExtensionInfoPlist[“CFBundleShortVersionString”] = myAppInfoPlist[“CFBundleShortVersionString”] | |
# Update Watch Kit App Plist | |
watchKitAppInfoPlist[“WKCompanionAppBundleIdentifier”] = myAppInfoPlist[“CFBundleIdentifier”] | |
watchKitAppInfoPlist[“CFBundleVersion”] = myAppInfoPlist[“CFBundleVersion”] | |
watchKitAppInfoPlist[“CFBundleShortVersionString”] = myAppInfoPlist[“CFBundleShortVersionString”] | |
# Save the Plists | |
plistlib.writePlist(myAppInfoPlist, “MyApp/Info.plist”) | |
plistlib.writePlist(watchKitExtensionInfoPlist, “WatchKitExtension/Info.plist”) | |
plistlib.writePlist(watchKitAppInfoPlist, “WatchKitApp/Info.plist”) |
This file contains 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
xcrun xcodebuild -sdk iphoneos -config "Release" |
This file contains 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
cp watchkitapp.mobileprovision MyApp.app/WatchKitExtension.appex/WatchKitApp.app/embedded.mobileprovision | |
cp watchkitextension.mobileprovision MyApp.app/WatchKitExtension.appex/embedded.mobileprovision | |
cp myapp.mobileprovision MyApp.app/embedded.mobileprovision |
This file contains 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
xcrun codesign -d --entitlements :- MyApp.app/WatchKitExtension.appex/WatchKitApp.app 2>/dev/null > watchkitapp.xcent | |
xcrun codesign -d --entitlements :- MyApp.app/WatchKitExtension.appex 2>/dev/null > watchkitextension.xcent | |
xcrun codesign -d --entitlements :- MyApp.app 2>/dev/null > myapp.xcent |
This file contains 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
# Order is important!! | |
# WatchKit App | |
rm -rf MyApp.app/Plugins/MyWatchKitExtension.appex/MyWatchKitApp.app/_CodeSignature | |
xcrun codesign -f -s "Certificate Name" -- entitlements watchkitapp.xcent MyApp.app/Plugins/MyWatchKitExtension.appex/MyWatchKitApp.app | |
# WatchKit Extension | |
rm -rf MyApp.app/Plugins/MyWatchKitExtension.appex/_CodeSignature | |
xcrun codesign -f -s "Certificate Name" -- entitlements watchkitextension.xcent MyApp.app/Plugins/MyWatchKitExtension.appex | |
# Main App | |
rm -rf MyApp.app/_CodeSignature | |
xcrun codesign -f -s "Certificate Name" -- entitlements myapp.xcent MyApp.app |
This file contains 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
xcrun -sdk iphoneos PackageApplication MyApp.app -o MyApp.ipa |
This file contains 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
# Extract the contents of the ipa | |
unzip MyApp.ipa | |
# Include WatchKitSupport | |
mkdir WatchKitSupport | |
cp "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/Library/Application\ Support/WatchKit/WK" WatchKitSupport/WK | |
# Repackage | |
zip -qr MyAppWithWatchKit.ipa Payload WatchKitSupport |
This file contains 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
# https://github.com/mxpr/ios-build-utils | |
from utils.packager import Packager | |
def package(): | |
ipa = Packager("MyAppWithWatchKit.ipa") | |
ipa.add("MyApp.app","Payload/MyApp.app") | |
ipa.add("/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/Library/Application\ Support/WatchKit/WK", "WatchKitSupport/WK") | |
ipa.package() |
its under the Plugins
folder
e.g. MyApp.app/Plugins/MyWatchKitExtension.appex
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello
thanks for the that .
i tried to do that but i cant find "WatchKitExtension.appex" inside "MyApp.app" folder
please i need help about that
thanks