# cd out of the mediapipe directory, then:
gitclonehttps://github.com/bazelbuild/tulsi.git
cdtulsi
# remove Xcode version from Tulsi's .bazelrc (see http://github.com/bazelbuild/tulsi#building-and-installing):
sed-i.orig'/xcode_version/d'.bazelrc
# build and run Tulsi:
shbuild_and_run.sh
การจัดสรรที่กำหนดเอง ซึ่งจะใช้โปรไฟล์การจัดสรรที่เชื่อมโยงกับบัญชีนักพัฒนาแอป Apple โปรไฟล์เหล่านี้มีอายุการใช้งานนานขึ้นและสามารถกําหนดเป้าหมายไปยังอุปกรณ์หลายเครื่องได้ แต่คุณต้องมีบัญชีนักพัฒนาแอปแบบชําระเงินกับ Apple จึงจะขอรับโปรไฟล์ได้
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-24 UTC"],[],[],null,["# MediaPipe Framework on iOS\n\nFollow instructions below to build iOS example apps with MediaPipe\nFramework. To learn more about these example apps, start from, start from [Hello\nWorld! on iOS](./hello_world_ios.md).\n\nBuilding iOS example apps\n-------------------------\n\n### Prerequisite\n\n1. Install Mediapipe Framework following these [instructions](./install.md).\n\n2. Install [Xcode](https://developer.apple.com/xcode/), then install the\n Command Line Tools using:\n\n xcode-select --install\n\n3. Install [Bazelisk](https://github.com/bazelbuild/bazelisk).\n\n We recommend using [Homebrew](https://brew.sh/) to get the latest versions. \n\n brew install bazelisk\n\n4. Install the Python \"six\" library. This is needed for TensorFlow.\n\n pip3 install --user six\n\n5. Clone the MediaPipe repository.\n\n git clone https://github.com/google/mediapipe.git\n\n### Set up a bundle ID prefix\n\nAll iOS apps must have a bundle ID, and you must have a provisioning profile\nthat lets you install an app with that ID onto your phone. To avoid clashes\nbetween different MediaPipe users, you need to configure a unique prefix for the\nbundle IDs of our iOS demo apps.\n\nIf you have a custom provisioning profile, see\n[Custom provisioning](/mediapipe/framework/getting_started/ios#custom_provisioning) below.\n\nOtherwise, run this command to generate a unique prefix: \n\n python3 mediapipe/examples/ios/link_local_profiles.py\n\n### Create an Xcode project\n\nThis lets you to edit and debug one of the example apps in Xcode. It also\nlets you to make use of automatic provisioning (see later section).\n\n1. We will use a tool called [Tulsi](https://tulsi.bazel.build/) for generating\n Xcode projects from Bazel build configurations.\n\n # cd out of the mediapipe directory, then:\n git clone https://github.com/bazelbuild/tulsi.git\n cd tulsi\n # remove Xcode version from Tulsi's .bazelrc (see http://github.com/bazelbuild/tulsi#building-and-installing):\n sed -i .orig '/xcode_version/d' .bazelrc\n # build and run Tulsi:\n sh build_and_run.sh\n\n This will install `Tulsi.app` inside the `Applications` directory in your\n home directory.\n2. Open `mediapipe/Mediapipe.tulsiproj` using the Tulsi app.\n\n | **Tip:** If Tulsi displays an error saying \"Bazel could not be found\", press the \"Bazel...\" button in the Packages tab and select the `bazel` executable in your homebrew `/bin/` directory.\n3. Select the MediaPipe config in the Configs tab, then press the Generate\n button below. You will be asked for a location to save the Xcode project.\n Once the project is generated, it will be opened in Xcode.\n\n If you get an error about bundle IDs, see the\n [previous section](/edge/mediapipe/framework/getting_started/ios#set_up_a_bundle_id_prefix).\n\n### Set up provisioning\n\nTo install applications on an iOS device, you need a provisioning profile. There\nare two options:\n\n1. Automatic provisioning. This allows you to build and install an app to your\n personal device. The provisioning profile is managed by Xcode, and has to be\n updated often (it is valid for about a week).\n\n2. Custom provisioning. This uses a provisioning profile associated with an\n Apple developer account. These profiles have a longer validity period and\n can target multiple devices, but you need a paid developer account with\n Apple to obtain one.\n\n#### Automatic provisioning\n\n1. Create an Xcode project for MediaPipe, as discussed\n [earlier](/mediapipe/framework/getting_started/ios#create_an_xcode_project)\n\n2. In the project navigator in the left sidebar, select the \"Mediapipe\"\n project.\n\n3. Select one of the application targets, for example, HandTrackingGpuApp.\n\n4. Select the \"Signing \\& Capabilities\" tab.\n\n5. Check \"Automatically manage signing\", and confirm the dialog.\n\n6. Select \"*Your Name* (Personal Team)\" in the Team dialog menu.\n\n7. This set-up needs to be done once for each application you want to install.\n Repeat steps 3-6 as needed.\n\nThis generates provisioning profiles for each app you have selected. Now you\nneed to tell Bazel to use them. We have provided a script to make this easier.\n\n1. In the terminal, to the `mediapipe` directory where you cloned the\n repository.\n\n2. Run this command:\n\n python3 mediapipe/examples/ios/link_local_profiles.py\n\nThis will find and link the provisioning profile for all applications for which\nyou have enabled automatic provisioning in Xcode.\n| **Note:** once a profile expires, Xcode will generate a new one; you must then run this script again to link the updated profiles.\n\n#### Custom provisioning\n\n1. Obtain a provisioning profile from Apple.\n\n| **Tip:** You can use this command to see the provisioning profiles you have previously downloaded using Xcode: `open ~/Library/MobileDevice/\"Provisioning\n| Profiles\"`. If there are none, generate and download a profile on [Apple's\n| developer site](https://developer.apple.com/account/resources/).\n\n1. Symlink or copy your provisioning profile to\n `mediapipe/mediapipe/provisioning_profile.mobileprovision`.\n\n cd mediapipe\n ln -s ~/Downloads/MyProvisioningProfile.mobileprovision mediapipe/provisioning_profile.mobileprovision\n\n| **Note:** if you had previously set up automatic provisioning, you should remove the `provisioning_profile.mobileprovision` symlink in each example's directory, since it will take precedence over the common one. You can also overwrite it with you own profile if you need a different profile for different apps.\n\n1. Open `mediapipe/examples/ios/bundle_id.bzl`, and change the `BUNDLE_ID_PREFIX` to a prefix associated with your provisioning profile.\n\n### Build and run an app using Xcode\n\n1. Create the Xcode project, and make sure you have set up either automatic or\n custom provisioning.\n\n2. You can now select any of the Mediapipe Framework demos in the target menu,\n and build and run them as normal.\n\n| **Note:** When you ask Xcode to run an app, by default it will use the Debug configuration. Some of our demos are computationally heavy; you may want to use the Release configuration for better performance.\n| **Note:** Due to an incompatibility caused by one of our dependencies, The Framework cannot be used for apps running on the iPhone Simulator on Apple Silicon (M1).\n| **Tip:** To switch build configuration in Xcode, click on the target menu, choose \"Edit Scheme...\", select the Run action, and switch the Build Configuration from Debug to Release. Note that this is set independently for each target.\n| **Tip:** On the device, in Settings \\\u003e General \\\u003e Device Management, make sure the developer (yourself) is trusted.\n\n### Build an app using the command line\n\n1. Make sure you have set up either automatic or custom provisioning.\n\n2. Using MediaPipe Hands for example, run:\n\n bazel build -c opt --config=ios_arm64 mediapipe/examples/ios/handtrackinggpu:HandTrackingGpuApp\n\n You may see a permission request from `codesign` in order to sign the app.\n | **Tip:** If you are using custom provisioning, you can run this [script](https://github.com/google/mediapipe/blob/master/build_ios_examples.sh) to build all Framework iOS example apps.\n3. In Xcode, open the `Devices and Simulators` window (command-shift-2).\n\n4. Make sure your device is connected. You will see a list of installed apps.\n Press the \"+\" button under the list, and select the `.ipa` file built by\n Bazel.\n\n5. You can now run the app on your device.\n\n| **Tip:** On the device, in Settings \\\u003e General \\\u003e Device Management, make sure the developer (yourself) is trusted."]]