Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
watchkit command line builds
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”)
xcrun xcodebuild -sdk iphoneos -config "Release"
cp watchkitapp.mobileprovision
cp watchkitextension.mobileprovision
cp myapp.mobileprovision
xcrun codesign -d --entitlements :- 2>/dev/null > watchkitapp.xcent
xcrun codesign -d --entitlements :- 2>/dev/null > watchkitextension.xcent
xcrun codesign -d --entitlements :- 2>/dev/null > myapp.xcent
# Order is important!!
# WatchKit App
rm -rf
xcrun codesign -f -s "Certificate Name" -- entitlements watchkitapp.xcent
# WatchKit Extension
rm -rf
xcrun codesign -f -s "Certificate Name" -- entitlements watchkitextension.xcent
# Main App
rm -rf
xcrun codesign -f -s "Certificate Name" -- entitlements myapp.xcent
xcrun -sdk iphoneos PackageApplication -o MyApp.ipa
# Extract the contents of the ipa
unzip MyApp.ipa
# Include WatchKitSupport
mkdir WatchKitSupport
cp "/Applications/\ Support/WatchKit/WK" WatchKitSupport/WK
# Repackage
zip -qr MyAppWithWatchKit.ipa Payload WatchKitSupport
from utils.packager import Packager
def package():
ipa = Packager("MyAppWithWatchKit.ipa")
ipa.add("/Applications/\ Support/WatchKit/WK", "WatchKitSupport/WK")

This comment has been minimized.

Copy link

AliAyasrah commented May 20, 2015

thanks for the that .

i tried to do that but i cant find "WatchKitExtension.appex" inside "" folder

please i need help about that


This comment has been minimized.

Copy link
Owner Author

ghost commented Jun 27, 2015

its under the Plugins folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.