Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CoreText header files are missing for the watchOS Simulator. This little script copies them from watchOS SDK easily.
#!/bin/sh
# CoreText.framework is missing for the watchOS Simulator (but is available on the device platform SDK)
# https://openradar.appspot.com/27844864
#
# This script is a quick patch to solve this issue, so we are all capable of running CoreText APIs on the Watch simulator too,
# by copying the WatchOS SDK's CoreText header files into the WatchSimulator's. This works great, although since editing the SDK files
# is protected, it needs to be run with sudo.
# Returns the appropriate platform path containing the framework headers
function headersPath() {
# Main Xcode path
XCODE_PATH=$( xcode-select --print-path )
echo "${XCODE_PATH}/Platforms/${1}.platform/Developer/SDKs/${1}.sdk/System/Library/Frameworks/${2}.framework/Headers/"
}
CoreText_WatchOS_Headers_Path=$( headersPath "WatchOS" "CoreText" )
CoreText_WatchSimulator_Headers_Path=$( headersPath "WatchSimulator" "CoreText" )
# Only perform if the CoreText framework headers are missing in the WatchSimulator
if [ ! -d ${CoreText_WatchSimulator_Headers_Path} ]; then
echo "Patch:$(tput setaf 1) Missing CoreText headers for WatchSimulator at path '${CoreText_WatchSimulator_Headers_Path}'.$(tput sgr0)"
# Copies the header files
sudo cp -R ${CoreText_WatchOS_Headers_Path} ${CoreText_WatchSimulator_Headers_Path}
echo "Patch:$(tput setaf 2) CoreText headers copied! You can now run your WatchOS apps using CoreText on the simulator.$(tput sgr0)"
else
echo "Patch:$(tput setaf 2) CoreText headers are already available on the WatchOS simulator.$(tput sgr0)"
fi
@steipete

This comment has been minimized.

Copy link

@steipete steipete commented Nov 6, 2016

@dzenbot

This comment has been minimized.

Copy link
Owner Author

@dzenbot dzenbot commented Nov 20, 2016

Maybe something @russbishop could have a look too?

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.