<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Clarence Chng on Medium]]></title>
        <description><![CDATA[Stories by Clarence Chng on Medium]]></description>
        <link>https://medium.com/@clarencechng?source=rss-11a8efbbfe4c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cIk_Fgb9x_G8HFCmay53JA.png</url>
            <title>Stories by Clarence Chng on Medium</title>
            <link>https://medium.com/@clarencechng?source=rss-11a8efbbfe4c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 14:10:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@clarencechng/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Practical Computer Vision using MediaPipe on Raspberry Pi 5]]></title>
            <link>https://medium.com/@clarencechng/practical-computer-vision-using-mediapipe-on-raspberry-pi-5-43ad6277a825?source=rss-11a8efbbfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/43ad6277a825</guid>
            <dc:creator><![CDATA[Clarence Chng]]></dc:creator>
            <pubDate>Tue, 14 Oct 2025 15:22:54 GMT</pubDate>
            <atom:updated>2025-10-16T02:05:50.842Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wko26I9rfIZNH2VP" /><figcaption>Photo by <a href="https://unsplash.com/@ionfet?utm_source=medium&amp;utm_medium=referral">Ion Fet</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Introduction to Computer Vision on the Raspberry Pi 5</h4><p>In today’s article, let us talk about how you can easily set up computer vision processing on the Raspberry Pi 5 using a USB Webcam using MediaPipe, an open source framework developed by Google.</p><p>MediaPipe is an open source framework that powers many of the AI-driven vision features you see in modern apps, and it could do lots of pretty cool computer vision tasks such as performing real-time face tracking or even hand gesture recognition!</p><p>Traditionally, developing computer vision systems meant collecting thousands of samples and labeled images and setting them up for training for deep learning models that could take up to hours or even days using traditional frameworks such as TensorFlow or PyTorch. Subsequently, you still have to perform fine-tuning of hyperparameters to ensure that the models are of the highest usable accuracy.</p><p>MediaPipe changes the game completely. The framework is highly modular and flexible, which provides pre-trained Macine Learning pipelines such as hand-tracking and facial recognition models out of the box — all wrapped in a ready to use API.</p><p>MediaPipe GitHub Repository: <a href="https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/python/solutions">https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/python/solutions</a></p><h4><strong>What will we be exploring?</strong></h4><ul><li>Creating a hand gesture recogniser application that inferences the gesture being made on screen</li><li>Facial recognizer application that detects the presence of a human face on screen</li></ul><h4>What do you need?</h4><ul><li>A USB Webcam</li><li>Raspberry Pi 5 (4GB) running Raspberry Pi OS 12 Bookworm <strong>(Note: This article has been tested to run on the Pi OS 12 Bookworm)</strong></li><li>Do note that some of the installation instructions <strong>may fail</strong> on the latest <strong>Pi OS 13 Trixie</strong> due to its Python library being updated to the latest Python v3.13. The libraries required in this article depends on the older version of Python v3.11 that Bookworm supports.</li><li>This will also work with earlier models of the Raspberry Pi, however it is recommended to use the Pi 5 with 4GB of RAM or greater for a better experience.</li></ul><h4>Downloading the Required Libraries (Pi OS 12 Bookworm)</h4><p>Once you have all the required hardware, let us proceed with installing all the required software and libraries. Open up your terminal and enter the following commands:</p><pre>$ sudo apt install python3-pip python3-virtualenv libatlas-base-dev<br><br>$ python3 -m venv myenv --system-site-packages<br><br>$ source myenv/bin/activate<br><br>$ pip3 install mediapipe opencv-python</pre><p>Note that the above commands to install the required packages may take some time depending on your internet speed.</p><h4>Downloading the Required Libraries (Pi OS 13 Trixie)</h4><p>As of the writing of this article (Oct 2025), MediaPipe does not support Trixie OS 13 due to a newer Python base version of 3.13. If you are still determined to run this example on the latest OS version, you can still do that by installing an older version of Python (v3.11) and execute it in a virtual environment. Complete the following steps to accomplish this:</p><pre>$ cd ~<br><br>$ wget https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tgz<br><br>$ tar -xzf Python-3.11.9.tgz<br><br>$ cd Python-3.11.9<br><br>$ sudo apt update<br><br>$ sudo apt install -y build-essential libssl-dev zlib1g-dev libncurses5-dev \<br>    libffi-dev libsqlite3-dev libreadline-dev libbz2-dev liblzma-dev<br><br>$ ./configure --enable-optimizations --prefix=/usr/local/python3.11<br><br>$ make -j$(nproc)<br><br>$ sudo make altinstall<br><br>$ cd ~<br><br>$ /usr/local/python3.11/bin/python3.11 -m venv ~/myenv311<br><br>$ source ~/myenv311/bin/activate<br><br>$ pip3 install mediapipe opencv-python</pre><h4>Hand &amp; Finger Tracking using MediaPipe</h4><p>Create a new Python script named <strong>hand_tracking.py </strong>and save it in the /home/pi directory. Populate it with the following statements:</p><pre>import cv2<br>import mediapipe as mp<br><br># Initialize MediaPipe Hands.<br>mp_hands = mp.solutions.hands<br>mp_drawing = mp.solutions.drawing_utils<br><br># For webcam input:<br>cap = cv2.VideoCapture(0)<br><br>with mp_hands.Hands(<br>    static_image_mode=False,<br>    max_num_hands=2,<br>    min_detection_confidence=0.5,<br>    min_tracking_confidence=0.5) as hands:<br><br>    while cap.isOpened():<br>        success, image = cap.read()<br>        if not success:<br>            print(&quot;Ignoring empty camera frame.&quot;)<br>            continue<br><br>        # Flip the image horizontally for a selfie-view display.<br>        image = cv2.flip(image, 1)<br>        # Convert the BGR image to RGB.<br>        image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)<br><br>        # Process the image and detect hands.<br>        results = hands.process(image_rgb)<br><br>        # Draw hand landmarks on the image.<br>        if results.multi_hand_landmarks:<br>            for hand_landmarks in results.multi_hand_landmarks:<br>                mp_drawing.draw_landmarks(<br>                    image, hand_landmarks, mp_hands.HAND_CONNECTIONS)<br><br>        # Display the image.<br>        cv2.imshow(&#39;MediaPipe Hands&#39;, image)<br><br>        if cv2.waitKey(5) &amp; 0xFF == 27:  # Press ESC to exit<br>            break<br><br>cap.release()<br>cv2.destroyAllWindows()</pre><p>Execute the following command:</p><pre>$ python3 hand_tracking.py</pre><p>You should now see your camera feed being displayed. Place your hands in front of the camera and see the system detecting your palm and fingers in real time</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*rHcutdrg6odK0yqPmvChCA.png" /><figcaption>Image by author</figcaption></figure><p>You should see that the MediaPipe framework is able to intelligently identify the 21 hand landmark points that constitutes a human palm. You may be wondering, what does all the 21 landmark represents and how does a landmark identify which finger it belongs to? The following list of landmarks will provide you with a better understanding of how MediaPipe does its classifications</p><p><strong>MediaPipe Hand Landmarks (Index 0 to 20)</strong></p><ul><li><strong>0 — Wrist:</strong> Base of the hand; root reference point for all coordinates.</li><li><strong>1 — Thumb_CMC:</strong> Carpometacarpal joint connecting the thumb to the wrist/palm.</li><li><strong>2 — Thumb_MCP:</strong> Metacarpophalangeal joint — first knuckle of the thumb.</li><li><strong>3 — Thumb_IP:</strong> Interphalangeal joint — second knuckle of the thumb.</li><li><strong>4 — Thumb_Tip:</strong> Fingertip of the thumb.</li><li><strong>5 — Index_MCP:</strong> Base knuckle of the index finger.</li><li><strong>6 — Index_PIP:</strong> Middle knuckle of the index finger.</li><li><strong>7 — Index_DIP:</strong> Distal knuckle just before the fingertip.</li><li><strong>8 — Index_Tip:</strong> Fingertip of the index finger.</li><li><strong>9 — Middle_MCP:</strong> Base knuckle of the middle finger.</li><li><strong>10 — Middle_PIP:</strong> Middle knuckle of the middle finger.</li><li><strong>11 — Middle_DIP:</strong> Distal knuckle before the fingertip.</li><li><strong>12 — Middle_Tip:</strong> Fingertip of the middle finger.</li><li><strong>13 — Ring_MCP:</strong> Base knuckle of the ring finger.</li><li><strong>14 — Ring_PIP:</strong> Middle knuckle of the ring finger.</li><li><strong>15 — Ring_DIP:</strong> Distal knuckle before the fingertip.</li><li><strong>16 — Ring_Tip:</strong> Fingertip of the ring finger.</li><li><strong>17 — Pinky_MCP:</strong> Base knuckle of the little finger.</li><li><strong>18 — Pinky_PIP:</strong> Middle knuckle of the little finger.</li><li><strong>19 — Pinky_DIP:</strong> Distal knuckle before the fingertip.</li><li><strong>20 — Pinky_Tip:</strong> Fingertip of the little finger.</li></ul><p>You will notice that your palm is represented by the following indexes:</p><ul><li><strong>Wrist: 0</strong></li><li><strong>Thumb: 1–4</strong></li><li><strong>Index: 5–8</strong></li><li><strong>Middle: 9–12</strong></li><li><strong>Ring: 13–16</strong></li><li><strong>Pinky: 17–20</strong></li></ul><h4><strong>Adding Gesture Inference and Count</strong></h4><p>Based on the above knowledge, we can try to add some intelligent inference and guesses to the gesture that the user has presented in front of the camera.</p><p><strong>Determining Thumb is Upright</strong></p><p>For example, if we want to determine that the user’s thumb is upright, based on a palm that is placed vertically in front of the camera (see Figure 1), we will take the points of the thumb and compare them horizontally.</p><p>Example if index 4 x-coordinates is less than index 3 x-coordinates, then we can imply that the thumb is upright.</p><p><strong>Determining Other Fingers are Upright</strong></p><p>Subsequently, for the other 4 fingers, since they are positioned in an upright position, we will compare the position of the joints vertically using their y axis to determine if they are upright.</p><p>Example if the index 5 y-coordinates is less than index 6 y-coordinates, then it implies that the index finger is upright.</p><p><strong>Inferences to the Gestures</strong></p><p>Now, since we have the logic to tell us which are the fingers that are raised, we can also add in our own inference of the gestures based on the finger(s) that are raised.</p><p>Example:</p><ul><li>Index and Middle Finger are up: <strong>“Yay gesture”</strong></li><li>Thumb is up: <strong>“Thumbs up”</strong></li><li>All fingers are up: “<strong>High five!</strong>”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*AylvQDjZm9ddgoVxzDUK2w.png" /><figcaption>Figure 1. Palm Figure (Image by author)</figcaption></figure><p>With the above simple inference logic, lets add this into our existing python script to further enhance our hand detection exercise! Update the previous codes with the following:</p><pre>import cv2<br>import mediapipe as mp<br><br># Initialize MediaPipe Hands.<br>mp_hands = mp.solutions.hands<br>mp_drawing = mp.solutions.drawing_utils<br><br># For webcam input:<br>cap = cv2.VideoCapture(0)<br><br>with mp_hands.Hands(<br>    static_image_mode=False,<br>    max_num_hands=2,<br>    min_detection_confidence=0.5,<br>    min_tracking_confidence=0.5) as hands:<br><br>    while cap.isOpened():<br>        success, image = cap.read()<br>        if not success:<br>            print(&quot;Ignoring empty camera frame.&quot;)<br>            continue<br><br>        # Flip the image horizontally for a selfie-view display.<br>        image = cv2.flip(image, 1)<br>        # Convert the BGR image to RGB.<br>        image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)<br><br>        # Process the image and detect hands.<br>        results = hands.process(image_rgb)<br><br>        # Draw hand landmarks on the image.<br>        if results.multi_hand_landmarks:<br>            for hand_landmarks in results.multi_hand_landmarks:<br>                mp_drawing.draw_landmarks(image, hand_landmarks, mp_hands.HAND_CONNECTIONS)<br><br>                # Extract landmark coordinates<br>                landmarks = hand_landmarks.landmark<br><br>                # Finger tip indices<br>                tip_ids = [4, 8, 12, 16, 20]<br>                fingers = []<br><br>                # Thumb<br>                if landmarks[tip_ids[0]].x &lt; landmarks[tip_ids[0]-1].x:<br>                    fingers.append(1)<br>                else:<br>                    fingers.append(0)<br><br>                # Other fingers<br>                for id in range(1, 5):<br>                    if landmarks[tip_ids[id]].y &lt; landmarks[tip_ids[id]-2].y:<br>                        fingers.append(1)<br>                    else:<br>                        fingers.append(0)<br><br>                total_fingers = fingers.count(1)<br><br>                # Gesture classification<br>                if fingers == [0,1,0,0,0]:<br>                    gesture = &quot;One up&quot;<br>                elif fingers == [0,1,1,0,0]:<br>                    gesture = &quot;Yay&quot;<br>                elif fingers == [1,0,0,0,0]:<br>                    gesture = &quot;Thumbs up&quot;<br>                elif fingers == [1,1,1,1,1]:<br>                    gesture = &quot;High five!&quot;<br>                elif total_fingers == 0:<br>                    gesture = &quot;Stop&quot;<br>                else:<br>                    gesture = &quot;&quot;<br><br>                # Annotating the finger count on the top left hand corner<br>                cv2.putText(image, f&#39;Fingers: {total_fingers}&#39;, (10, 50),<br>                            cv2.FONT_HERSHEY_SIMPLEX, 1, (0,255,0), 2)<br>                cv2.putText(image, f&#39;Gesture: {gesture}&#39;, (10, 100),<br>                    cv2.FONT_HERSHEY_SIMPLEX, 1, (255,0,0), 2)<br><br>        cv2.imshow(&#39;Hand Tracking + Finger Count&#39;, image)<br><br>        if cv2.waitKey(5) &amp; 0xFF == 27:<br>            break<br><br>cap.release()<br>cv2.destroyAllWindows()<br></pre><p>Execute the following command:</p><pre>$ python3 hand_tracking.py</pre><p>You should now see your camera feed being displayed. Place your hands in front of the camera and see the system detecting your palm and fingers in real time. Now you will also see 2 lines of annotations on the top left corner of the camera playback. It shows you the number of fingers detected as well as the interpreted gesture seen on screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*33OS1Z6W4oyyATxIRG9_bA.png" /><figcaption>Image by author</figcaption></figure><p>Nice! You have now completed the hand detection recognition system running entirely on your Raspberry Pi! There are tons of practical real-world uses of hand gestures recognition, such as implementing touchless control in your application which can serve as an accessibility tool for users to navigate your application without the need for keyboards and mouse.</p><h4>Face Detection using MediaPipe</h4><p>Create a new Python script named <strong>face_tracking.py </strong>and save it in the /home/pi directory. Populate it with the following statements:</p><pre>import cv2<br>import mediapipe as mp<br><br>mp_face_detection = mp.solutions.face_detection<br>mp_drawing = mp.solutions.drawing_utils<br><br># Open the camera<br>cap = cv2.VideoCapture(0)<br>if not cap.isOpened():<br>    print(&quot;Error: Could not open camera.&quot;)<br>    exit()<br><br># Initialize MediaPipe FaceDetection<br>with mp_face_detection.FaceDetection(<br>    model_selection=0, min_detection_confidence=0.5) as face_detection:<br><br>    while True:<br>        success, frame = cap.read()<br>        if not success:<br>            print(&quot;Ignoring empty frame.&quot;)<br>            continue<br><br>        frame = cv2.flip(frame, 1)<br>        frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)<br>        results = face_detection.process(frame_rgb)<br><br>        # Draw face detections<br>        if results.detections:<br>            for detection in results.detections:<br>                mp_drawing.draw_detection(frame, detection)<br><br>        # Display the frame<br>        cv2.imshow(&#39;MediaPipe Face Detection&#39;, frame)<br><br>        # ESC to exit<br>        if cv2.waitKey(5) &amp; 0xFF == 27:<br>            break<br><br># Release resources<br>cap.release()<br>cv2.destroyAllWindows()</pre><p>Execute the following command:</p><pre>$ python3 face_tracking.py</pre><p>You should see that a box and dots will be drawn on top of the face that is being detected on screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*neqtIXv-vhI7xhh0igZQxw.png" /><figcaption>Image by author</figcaption></figure><p><strong>MediaPipe Face Detection Landmarks</strong></p><p>The face detection model by MediaPipe can detect 6 number of landmarks of a human face as follows:</p><ul><li>0 — Right eye</li><li>1 — Left eye</li><li>2 — Nose tip</li><li>3 — Mouth center</li><li>4 — Right ear</li><li>5 — Left ear</li></ul><p>Awesome You have now completed the face detection recognition system running entirely on your Raspberry Pi! There are tons of practical real-world uses of facial recognition especially in Closed Circuit Televisions (CCTVs) monitoring systems. Such technology is used in detecting presence of people in the recording and sending alerts or notifications out to inform that the system has detected someone present (most likely an intruder).</p><h4>MediaPipe is great! What’s next?</h4><p>So now you have completed 2 impressive systems — a hand gesture recognizer and a facial detection system, based on the pre-trained models provided by MediaPipe. However, there are even more models that MediaPipe provides that are not covered within the scope of this article.</p><p><a href="https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/modules">https://github.com/google-ai-edge/mediapipe/tree/master/mediapipe/modules</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VsNgfhum7TpmbjfkhPA7jQ.png" /><figcaption>Image by author</figcaption></figure><p>In the list of pre-trained models provided by MediaPipe, we have used the <strong>face_detection</strong> and <strong>hand_landmark</strong> pre-trained models in the above examples. However, there are many more different models with different use cases, for example:</p><p><strong>iris_landmark</strong></p><ul><li>Tracks the iris of a human eye with 5 landmarks for precise eye tracking</li><li>Use case: Gaze estimation, eye-contact correction and attention tracking</li></ul><p><strong>pose_detection</strong></p><ul><li>Tracks human body poses and key skeletal points</li><li>Use case: Fitness tracking, activity recognition and posture detection</li></ul><h4>Bringing AI Vision to the Edge</h4><p>In this article, you’ve learned how to bring powerful computer vision capabilities to the Raspberry Pi 5 using MediaPipe’s pre-trained models. From detecting faces to recognising hand gestures, you now have two complete AI systems running entirely on a tiny edge device — no cloud required.</p><p>MediaPipe simplifies what used to be a complicated pipeline of data collection, training, and optimisation into a few lines of Python code. Whether you’re building a home automation system, a smart classroom demo, or just exploring AI for fun, the possibilities are endless.</p><p>If you enjoyed this tutorial, consider sharing it or leaving a comment with what you plan to build next — I’d love to hear about your experiments with MediaPipe on the Pi!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43ad6277a825" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interacting with Large Language Models (LLMs) on your Raspberry Pi 5]]></title>
            <link>https://medium.com/@clarencechng/interacting-with-large-language-models-llms-on-your-raspberry-pi-5-e199f453ce1f?source=rss-11a8efbbfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e199f453ce1f</guid>
            <dc:creator><![CDATA[Clarence Chng]]></dc:creator>
            <pubDate>Wed, 08 Oct 2025 06:00:23 GMT</pubDate>
            <atom:updated>2025-10-08T06:00:23.095Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Sfy6BsAWDklyC98C" /><figcaption>Photo by <a href="https://unsplash.com/@harrisonbroadbent?utm_source=medium&amp;utm_medium=referral">Harrison Broadbent</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Introduction to LLMs on Raspberry Pi</strong></p><p>In this article, lets talk about the usage of Large Language Models (LLMs) on the Raspberry Pi. You might be thinking… wait a second! The Raspberry Pi can support an LLM by itself? Yes, it can! But it can only support certain models depending the hardware capability of your Raspberry Pi!</p><p>In this article, we will explore how to:</p><ul><li>Install Ollama on a Raspberry Pi</li><li>Download and run TinyLlama, a lightweight LLM that is capable of running on the Raspberry Pi</li><li>Building a simple Python chatbot that interacts with the TinyLlama LLM locally</li></ul><p>What do you need?</p><ul><li>A Raspberry Pi 5 with 4GB or RAM or more (2GB version is tested to work for this article, but having more RAM would be much preferred)</li><li>An SD card that is at least 16GB in capacity</li></ul><p><strong>Installing Ollama</strong></p><p>On your Raspberry Pi, open up the Terminal window and execute the following command to install Ollama.</p><ul><li><strong>Ollama</strong> is a tool that allows you to install and run LLMs locally on your device. Think of it like the ChatGPT service that you use which runs the GPT5 LLM behind the scenes. The key point of using your own LLM is that it runs fully offline and the data you interact with is totally private!</li></ul><pre>$ curl -fsSL https://ollama.com/install.sh | sh</pre><p>Once Ollama has completed the installation, let us verify that it has been installed successfully</p><pre>$ ollama --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*Q2biTNirOsN7q7TufVeydA.png" /></figure><p>Let us now install the LLM that we want to use on the Raspberry Pi. Depending on the variant of the Raspberry Pi that you have, you may install more powerful models such as qwen, llama or even deepseek-r1 assuming you have the 8GB or 16GB variants of the Raspberry Pi. In this example, we will be using the TinyLlama model which is a lightweight model meant for devices with smaller computing power like the 2GB and 4GB Raspberry Pi variants.</p><p>In Terminal, execute the following command to download the latest version of the TinyLlama LLM:</p><pre>$ ollama pull tinyllama:latest</pre><p>Once the model has been downloaded to your Raspberry Pi, let us verify that TinyLlama is properly installed:</p><pre>$ ollama list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*X3lfGKT44p7geu6LPtjCyg.png" /></figure><p>Once we have verified that it is installed, we can start interacting with the LLM! Let’s enter the following command:</p><pre>$ ollama run tinyllama:latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*dWJGwPQE6QtcZAeKkGj-aQ.png" /></figure><p>If you see the “Send a message” prompt, you are good to go! You can proceed to interact with the LLM. For a start, you can ask TinyLlama: “Why is the sky blue?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*j6dj4tExqfHIcGNxKz2FAA.png" /></figure><p><strong>Performance Tips:</strong> You should now notice that it may take a while for your Raspberry Pi to process your query. LLMs are CPU intensive and uses high computational power in its CPU cores to process your query. To enhance the experience, you may choose to acquire the <a href="https://www.raspberrypi.com/products/active-cooler/"><strong>Raspberry Pi Active Cooler</strong></a> to dissipate heat off the CPU!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NYZp-OwbUruCWZ6IQ6KVOQ.png" /></figure><p><strong>Interacting with LLMs Programmatically</strong></p><p>Create a new Python file named <strong>ollama.py</strong> and save it in the <strong>/home/pi</strong> directory. Populate it with the following statements:</p><pre>import subprocess<br><br>def ask_ollama(prompt, model=&quot;tinyllama&quot;):<br>    &quot;&quot;&quot;<br>    Sends a prompt to Ollama CLI and returns the response.<br>    &quot;&quot;&quot;<br>    print(&quot;Processing...&quot;)<br>    result = subprocess.run(<br>        [&quot;ollama&quot;, &quot;run&quot;, model],<br>        input=prompt.encode(),<br>        stdout=subprocess.PIPE,<br>        stderr=subprocess.PIPE<br>    )<br><br>    if result.returncode != 0:<br>        raise Exception(f&quot;Error: {result.stderr.decode()}&quot;)<br><br>    return result.stdout.decode().strip()<br><br><br>def chat_loop(model=&quot;tinyllama&quot;):<br>    print(&quot;Chatbot started! Type &#39;exit&#39; or &#39;quit&#39; to quit.&quot;)<br>    try:<br>        while True:<br>            user_input = input(&quot;\nYou: &quot;)<br>            if user_input.lower() in [&quot;exit&quot;, &quot;quit&quot;]:<br>                print(&quot;Exiting...&quot;)<br>                break<br>            response = ask_ollama(user_input, model=model)<br>            print(f&quot;Bot: {response}&quot;)<br>    <br>    except(KeyboardInterrupt):<br>        print(&quot;Exiting...&quot;)<br><br><br>if __name__ == &quot;__main__&quot;:<br>    chat_loop()</pre><p>Execute your Python script:</p><pre>$ python3 ollama.py</pre><p>You will be prompted to enter your prompt to interact with TinyLlama. You can ask a question like “Why is the earth round?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*eMNBHxQOUSR8P4sIMOTtgg.png" /></figure><p>The script will run in a forever-loop, acting like a chatbot that always await your questions. To exit the program, you can do a <strong>Control-C</strong> or type in the <strong>exit</strong> or <strong>quit</strong> command.</p><p><strong>Conclusion</strong></p><p>In conclusion, we can see that the Raspberry Pi indeed can host real LLMs locally despite lacking of the computational power of a modern GPU. With free-to-use tools like Ollama and TinyLlama, you can have your own ChatGPT setup using your own hardware completely offline and private!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e199f453ce1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Prepare, Host and Distribute Your iOS App for Ad-Hoc Distribution (Part 2 of 2)]]></title>
            <link>https://medium.com/@clarencechng/how-to-prepare-host-and-distribute-your-ios-app-for-ad-hoc-distribution-part-2-of-2-e064776f6407?source=rss-11a8efbbfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e064776f6407</guid>
            <category><![CDATA[ios-ad-hoc-distribution]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[ad-hoc]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Clarence Chng]]></dc:creator>
            <pubDate>Sun, 07 Aug 2022 08:03:57 GMT</pubDate>
            <atom:updated>2022-08-09T02:01:36.100Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_TF41GE3B9jE_O9qKeqzdw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@cgower?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Christopher Gower</a> on <a href="https://unsplash.com/s/photos/coding?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p><strong>Introduction to Over-the-Air iOS Ad-Hoc Distribution</strong></p><p>In my previous <a href="https://medium.com/@clarencechng/how-to-prepare-host-and-distribute-your-ios-app-for-ad-hoc-distribution-f8aba8e3cd10">article</a>, we have demonstrated how you can easily create an application and share it with your users using the Ad-Hoc Distribution method. However, it has a limitation which requires users to have a Mac to physically install the application on their devices. It might not be the simplest way after all to install an app, especially if your user isn’t tech-savvy.</p><p>In this article, we will show you how to setup a cloud-based Apache Web Server using DigitalOcean’s services to host your application remotely. We will be showing you the various ways you can invite your users to install and update the application on their devices without any technicalities involved.</p><blockquote>This article assumes that you can completed the previous tutorial on Part 1 of this article, and you already have the basic understanding of the Ad-Hoc distribution process. We will be continuing from where we left off from the first part of the article. If you have yet to attempt the previous part, please take 15 minutes of your time to read through before attempting this article.</blockquote><p><strong>What we will be covering in this article</strong></p><ul><li>Registering and Creating a LAMP Server instance on DigitalOcean</li><li>Enabling HTTPS on our Apache Server using LetsEncrypt &amp; CertBot</li><li>Distributing our iOS App on our Cloud Apache Server using URL</li><li>Various methods to provide App Updates to your users</li></ul><p><strong>What do you need?</strong></p><ul><li>Paid Apple Developer Program (USD99/year)</li><li>A Mac that supports recent versions of Xcode</li><li>Xcode (I’ll be using Xcode 13.4.1 in this article)</li><li>FileZilla</li><li>iOS Device (Preferably one that supports the latest version of iOS)</li><li>A domain name (eg. mywebhosting.com)</li><li>An Apache Web Server (I’ll be using a LAMP server instance running on DigitalOcean)</li><li>A valid SSL Certificate (Free if you own your domain name)</li></ul><h3>Registering for a Domain Name with GoDaddy</h3><p>To begin, we will need to register for a domain name for us to hook up with our cloud web server. With a valid domain name, we would be able to generate a valid SSL certificate and enable HTTPS for your web service to ensure that the connection between your users and the server is secure. It is also a requirement by Apple that the server hosting the application must have an address beginning with HTTPS.</p><p>Purchasing a domain name is pretty affordable. In this article, I will be using a domain that was purchased on <a href="http://godaddy.com/">GoDaddy</a> for less than $2 USD (one year). You can select your own preferred domain that is not so popular (domain names are pricier if they contain popular keywords) but easy to remember. Once you have completed your purchase, click on your own name at the top right corner of the page and select <strong>Manage Domains</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ca7mjl7jC2Epyd7loN-35Q.png" /></figure><p>You should be able to see the domain you have purchased earlier reflected in here. In this article, I will be using <strong><em>sleektechnologies.store</em></strong> that I have purchased earlier as my domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TNdE04ZAP50rsTxakN6FhQ.png" /></figure><h3>Registering for a Cloud Web Server with DigitalOcean</h3><p>To begin, head to DigitalOcean’s site and sign up if you are a new user. Once you have done that, let us create a new project in DigitalOcean.</p><p>Enter the following information</p><ul><li><strong>Project Name: <em>AdHocHelloWorld</em></strong></li><li><strong>Description: <em>HelloWorld</em></strong></li><li><strong>Purpose: <em>Service or API</em></strong></li></ul><p>Click <strong>Create Project</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*GP2hYKsm0dkATHMK2WY94Q.png" /></figure><p>On the next page, select <strong>Skip for Now</strong> for moving of resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*lz7vLRloBzj9hvOiU_-T3g.png" /></figure><p>Once you are in your project main page, click on the green <strong>Create </strong>button at the top right corner of the page and select <strong>Droplets</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mnBSXHoQLPTnH88vwxzuVg.png" /></figure><p>In the <strong>Create Droplets</strong> page, select on <strong>Marketplace</strong> tab. We will be selecting a pre-packaged LAMP server instance as our Droplet. This will save us time and the technicalities involved in installing all the various packages from scratch. We will be up and running in no time.</p><p>Select the <strong>LAMP Latest on Ubuntu 20.04 </strong>image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PjDa0fZDq3K18gIFE1T_Tg.png" /></figure><blockquote>LAMP refers to Linux, Apache, MySQL and PHP. We will primarily focus on Apache to help us serve our files to the internet.</blockquote><p>Configure the image with the following settings:</p><ul><li><strong>Plan: Basic</strong></li><li><strong>CPU Option: Regular with SSD</strong></li><li><strong>Tier: $6 USD/month (1GB RAM, 1 CPU Core, 25GB SSD, 1TB data transfer quota)</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9WfLDeUwW4mca6xcxfb1VQ.png" /></figure><blockquote>Depending on the file size and number of files you wish to host on the server, you should select the most appropriate tier for your own use case. As this article is simply hosting iOS app packages that is &lt; 10 MB in size, the lowest tier of their server instance would suffice for our use case.</blockquote><p>Select the datacenter region closest to you. In my case, I will be selecting the Singapore server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GlUIri5VUE0zF5YTHV9d2g.png" /></figure><p>Enter a complex password that will be used to administer the web server. Note that the password must fulfil the password complexity requirement set by DigitalOcean.</p><blockquote>Please keep your password safe as you will require it to administer your web server in the future.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*15T0RaVxlsc9ZCT_uqhqoA.png" /></figure><p>Finally, leave the rest of the settings as default and select <strong>Create Droplet</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JFuRqyAign_FFcrsHe-dOg.png" /></figure><p>Once the droplet has been created successfully, you should see this on your projects’s main page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cxJHusBd6pvNozCRpmoroA.png" /></figure><h3>Configuring Your Domain Name to Point to DigitalOcean Nameservers</h3><p>Next we will be setting up our domain name to point to the DigitalOcean droplet that we have created earlier.</p><p>On the <strong>All Products and Services</strong> Page of your GoDaddy’s site, look for your newly purchased domain and click on the <strong>DNS</strong> button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*_Hsuyrdt1vqQcu4MUJep3A.png" /></figure><p>On the DNS page under the <strong>Nameservers </strong>section, click on <strong>Change</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fnXCGeZOzk1k-V7_vq_K7A.png" /></figure><p>Select on <strong>Enter my own nameservers (advanced) </strong>option at the bottom of the dialog and enter the following nameservers into the fields provided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9GEOYE0ARLX_V85i9wYQA.png" /></figure><ul><li>ns1.digitalocean.com</li><li>ns2.digitalocean.com</li><li>ns3.digitalocean.com</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*yPL1tWQTPgpGHIdSjtnaBg.png" /></figure><p>Then provide consent to change the Nameservers and select <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*aoBJChvMWanvTHvK_WUkHw.png" /></figure><p>Next, we will have to do some configurations to our DigitalOcean portal to point to our domain names. On your DigitalOcean’s <strong>Control Panel</strong>, select on the <strong>Create </strong>button at the top and click on <strong>Domains/DNS</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*vyzC7ratAYuacWS1h6a3lQ.png" /></figure><p>On the Networking page, add your purchased domain name and assign it to our AdHocHelloWorld project. Click <strong>Add Domain</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5P8Fks0k47G9iktzzFMIJA.png" /></figure><p>Once done, you should be able to see a similar page like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*we_af-nD9nfQ1NBA3BEoMQ.png" /></figure><p>Under the <strong>Create new record</strong> section, let us add <strong>2 A Records</strong> that points to our domain</p><ul><li><strong>Hostname 1: @</strong></li><li><strong>Hostname 2: www</strong></li><li><strong>Will Direct To: &lt;Your AdHocHelloWorld Project Droplet&gt;</strong></li></ul><p>Click on <strong>Create Record</strong>.</p><blockquote>Adding the A Records allow you to specify how your user can access your server. In our case, our user can access our server from both sleektechnologies.store as well as www.sleektechnologies.store.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zLX_r7wcrwknwiUAx0xAmA.png" /></figure><p>After you have successfully created the 2 <strong>A Records</strong>, verify that your DNS Records table have 5 entries in total. You will have <strong>3 NS</strong> and <strong>2 A Records</strong> in your table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RpCFVpwKTgXKuaUJw5aA1Q.png" /></figure><h3>Setting Up SSL on Your Droplet</h3><p>Let us access our Droplet by using the Console provided by DigitalOcean. On your project page, click on the <strong>Console</strong> button at the top right corner to open up a console terminal on your browser to remotely manage your web server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9p9e9HCXlKpTX9CNKhmIlQ.png" /></figure><p>You should now see a new web browser window pop up with the terminal access of your cloud LAMP server Droplet instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZLfdEUz2v-rXFj9owD3Xcw.png" /></figure><p>Enter the following command</p><pre>sudo nano /etc/apache2/sites-available/000-default.conf</pre><p>Enter the following codes into the <strong>&lt;VirtualHost *:80&gt;</strong> section</p><pre>ServerName &lt;YOUR DOMAIN NAME&gt;<br>ServerAlias www.&lt;YOUR DOMAIN NAME&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*SLzmYGDMses6jEMOQamgpw.png" /></figure><p>Press <strong>Ctrl-X</strong> and then <strong>Y</strong> and hit <strong>Enter</strong> to save the modified configuration file. For your Apache2 to take effect of the newly added changes, we will need to restart the Apache2 service. Execute the following commands to restart the Apache2 service on your server.</p><pre>sudo systemctl restart apache2</pre><p>Next, execute the following command to install CertBot for the SSL Certificates on your web server.</p><pre>sudo apt install certbot python3-certbot-apache</pre><p>It will update the server to install and update the required packages to facilitate the generation of our SSL certificates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*qTZ4HHEWQWwGhd_CMatfMQ.png" /></figure><p>Next, enter the following command to obtain an SSL Certificate</p><pre>sudo certbot --apache</pre><p>You will be prompted to enter an email address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*0BngOMpLM50bMhUUtc7lAQ.png" /></figure><p>Accept the Agreement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*nhBaJ5BMmYeSIYfcMT_Svg.png" /></figure><p>For the next option, it is up to your discretion if you would like to share your email with the Foundation related to the Let’s Encrypt project. In my case, I will not be sharing my email address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*7JzIcM8gkl0GlEi7D4Rvog.png" /></figure><p>Enter <strong>1</strong> and press <strong>Enter </strong>to select the first option</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*04VTyObWf_iqG2BbgO3WPg.png" /></figure><p>Enter <strong>2</strong> and press <strong>Enter </strong>to select the Redirect option. Redirect simply means that all unencrypted channels (HTTP) to your site will be automatically directed to use HTTPS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*v529xP2RcuDpvudVndleRQ.png" /></figure><p>Finally, if everything goes well, you should see the following congratulations message to signify that the whole process has completed successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*4Y22dRsUor2Ost8OACJYrA.png" /></figure><p>On your browser, you can head to your domain using HTTPS and you should see the following webpage. The default webpage shown is provided by DigitalOcean and you can choose to remove it to display your own personal webpage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s4VFUffqtChY7TpljMce5w.png" /></figure><p>If you are able to see the above webpage, congratulations! You are just a step away from hosting your application!</p><h3>Preparing your iOS Application for Web Hosting</h3><p>Now, let us re-revisit our AdHocHelloWorld iOS Xcode project we have created from the previous article. Based on the previous compiled archive of our AdHocHelloWorld iOS App in Organizer, let us distribute the app to our web server.</p><p>To open up Xcode Organizer, go to the <strong>Xcode Menu Bar -&gt; Window -&gt; Organizer</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qHGVGxyH0yBqS11iE34WVw.png" /></figure><p>You should see the <strong>Organizer</strong> window with all the past archive(s) of your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IRb-pP2CVtAxmz8wvKKB3w.png" /></figure><p>Select the latest archive that we compiled from our previous article and click on <strong>Distribute App</strong>. Select on <strong>Ad Hoc </strong>distribution method and click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*OCjROYZEpp1-6713dV3h7A.png" /></figure><p>On the Ad Hoc Distribution Options page, check on <strong>Include manifest for over-the-air installation </strong>and click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*365dUDJA8KYjqPopDKnwSA.png" /></figure><blockquote>Note that we did not check on this manifest option in our previous article as this option is meant for distribution of app over-the-air using web servers.</blockquote><p>Enter the following information for the Distribution Manifest Information</p><ul><li><strong>Name: AdHocHelloWorld</strong></li><li><strong>AppURL: https://&lt;YOUR_DOMAIN_URL&gt;/AdHocHelloWorld.ipa</strong></li><li><strong>Display Image URL: https://&lt;YOUR_DOMAIN_URL&gt;/image.png</strong></li><li><strong>Full Size Image URL: https://&lt;YOUR_DOMAIN_URL&gt;/image.png</strong></li></ul><p>Click on <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*8HwCaNB1mMqmOe4PhcZp3w.png" /></figure><p>Select <strong>Manually manage signing</strong>. Click on <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*0PHkJCHnYA6QKOZ59tb4CA.png" /></figure><p>For the <strong>Distribution Certificate</strong>, select on the provisioning profile we have created from the previous article. Click on <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*q3FOXFugwPQ8I63aYfOCdw.png" /></figure><p>Once it is ready, click on <strong>Export</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*10-fCdU8HeUvPfbOivUakQ.png" /></figure><p>Save the exported file to your preferred location on your computer</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*_lVoa6AMru0NjOr0wJWE-Q.png" /></figure><p>Opening up the folder, you should see a total of 5 files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*cPWzef5X-WCPqgDJ0tNYQQ.png" /></figure><p>If you noticed, there is an additional file in this folder compared to the previous export from our previous article. The additional file is <strong>manifest.plist</strong>.</p><p>If you are interested, you can open up the plist file in a text editor and take a look at its contents. This manifest file essentially acts as a piece of instruction for the server to know where to locate the application and app icons when your user attempts to install your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3SsetdqS8TEAniby7WnvRA.png" /></figure><h3>Using FileZilla for File Transfer</h3><p>Now, with our app server ready for file hosting and our app ready for distribution, let us use a File Transfer application to upload our files to our web server. For ease of use, we will be using the <a href="https://filezilla-project.org/">FileZilla</a> application to manage our files on our web server. Download the latest client and install it on your computer. Launch the app as soon as it is ready!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vHVJP3J93ckqIbpdnfWigw.png" /></figure><p>At the top left corner of FileZilla, click on the Site Manager button to bring up the Site Manager. At the bottom left corner of the Site Manager, click on <strong>New Site</strong>. Do the following settings for your web server connection</p><ul><li><strong>Protocol: SFTP</strong></li><li><strong>Host: &lt;YOUR DOMAIN URL&gt;</strong></li><li><strong>Logon Type: Normal</strong></li><li><strong>User: root</strong></li><li><strong>Password: &lt;YOUR PASSWORD FOR YOUR DIGITALOCEAN DROPLET&gt;</strong></li><li>You may choose to rename your connection name to a name you can easily identify if you have many other connections in your FileZilla site manager.</li></ul><p>Click on <strong>Connect</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CoeJS0tuw3gMm2Ru2qx0ZQ.png" /></figure><p>If the connection is successful, you should see the following prompt. Click on <strong>OK</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/1*pFKyoOjMKX-hCvq-CELQaw.png" /></figure><p>You should now see that the right table of your FileZilla app is showing the /root directory of your web server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jebK5B0iayFvz5jTPTl0VQ.png" /></figure><p>Congratulations! You are now connected to your web server. Let us take a look at the web publishing directory of your web server! In the remote site bar on the right, change the directory from <strong>/root </strong>to <strong>/var/www/html</strong>.</p><p>The <strong>/var/www/html</strong> is the main web publishing directory for Apache and in this folder, you should see one file — <strong>index.html</strong>. This index.html file is the webpage you will see when you try to access your web server from the web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ToOZszz5DkgLmMD3HZ7owA.png" /></figure><p>Let us remove this index.html file. Right click on the file and select <strong>Delete</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*5N3SpXzZlSZEPT9I7gixZw.png" /></figure><p>On the left table of FileZilla, look for the compiled app package folder in your computer’s directory. Select the following 2 files: <strong>AdHocHelloWorld.ipa</strong> and <strong>manifest.plist</strong> and transfer them over to your server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*TLkH8lSaED8b0_OpB-8_5Q.png" /></figure><p>Right click and select <strong>Upload</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*hECtVodZrYhfKzG3P18k5Q.png" /></figure><p>You should now see that the 2 files are now on your web server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*uaqNdvMFVpCUe9wprrNMmA.png" /></figure><p>Next we will create our own webpage so that your users can view and download your application onto their devices. In your preferred code editor, (I’ll be using Visual Studio Code) create a new <strong>index.html</strong> file and enter the following set of codes</p><pre>&lt;!DOCTYPE HTML&gt;</pre><pre>&lt;html lang=&quot;en-US&quot;&gt;</pre><pre>    &lt;head&gt;</pre><pre>        &lt;meta charset=&quot;UTF-8&quot;&gt;</pre><pre>        &lt;title&gt;Ad Hoc Hello World App Download&lt;/title&gt;</pre><pre>    &lt;/head&gt;</pre><pre>    &lt;body&gt;</pre><pre>        &lt;h1&gt;Ad Hoc Hello World App Download&lt;/h1&gt;</pre><pre>        &lt;a href=&quot;itms-services://?action=download-manifest&amp;url=https://&lt;YOUR DOMAIN URL&gt;/manifest.plist&quot;&gt;Install Application!&lt;/a&gt;</pre><pre>    &lt;/body&gt;</pre><pre>&lt;/html&gt;</pre><p>Similarly, upload this index.html file to your web server. Your web server should have 3 files now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*KwdaLUkc4tnmqDVjwwC3zg.png" /></figure><p>We are now ready to install the application!</p><h3>Installing &amp; Updating Your App using a URL Link</h3><p>On your UDID-registered iOS device, open up Safari and navigate to your own domain url.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*m-PN997dg45G8LlFZceStw.png" /></figure><p>You should see this webpage with a clickable button to install the application. Click on <strong>Install Application! </strong>You will now see a pop-up prompt to seek your approval to install the application onto your device. Select <strong>Install</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*oIHs_ZTfVz7W6hvY3_BBqw.png" /></figure><p>Exit Safari and navigate back to your home screen of your iOS device. You should now see the newly installed AdHocHelloWorld application on your device!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*zNd1BAppAiVYGqVXiqBmFQ.png" /></figure><p>Click on the app to launch it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*8jsRMYyuw_pQ4DP0nvT3QA.png" /></figure><p>Hooray! You have now successfully managed to get your users to remotely install your application through the URL domain link you have provided for them!</p><p>Subsequently, you will also be able to provide future app updates for your application using this method. Just add in the updates to your Xcode project, recompile using the same method that we have done earlier and upload the compiled version of the app to your app server. Once the update has been added to the server, get your users to go to the same project link and get them to install the application again. They will be able to install the newer version of your app on their iOS devices.</p><h3>Updating Your App Programmatically</h3><p>The previous method is a good way for your users to update their application given that they have to remember your url and open up the browser to fetch your updates. But could there be a more efficient method to provide a way to update the app programmatically within the application itself? You can!</p><p>In your project’s <strong>ContentView.swift</strong> file, add in the following set of codes:</p><pre>Button(&quot;Update Application&quot;, action: {</pre><pre><strong>if</strong> <strong>let</strong> url = URL(string: &quot;itms-services://?action=download-manifest&amp;url=https://&lt;YOUR DOMAIN NAME&gt;/manifest.plist&quot;) {</pre><pre>      UIApplication.shared.open(url)</pre><pre>   }</pre><pre>})</pre><blockquote>Take note that the code above only works for real devices. If you were to run the code on Xcode’s simulators, clicking on the <strong>Update Application</strong> would have no effect.</blockquote><p>Install the application on your devices. Subsequently, update the application and push the updates onto your web server. Once the app is updated, click on the <strong>Update Application</strong> button in the AdHocHelloWorld application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*hVqVkT7RUIEwcTQH1nw57Q.png" /></figure><p>The app will similarly prompt you if you want to install the application from your web server. Click on <strong>Install</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*aYZUSOHxmkB2dnMt5qsGbg.png" /></figure><p>Your app should automatically close and you can now reopen the updated app on your home screen.</p><p>This will definitely be a simplified process for your users, especially if they aren’t tech savvy.</p><h3>Intuitive Things to Do with this Implementation</h3><p>With some creative imagination, you can also implement your own app versioning system so that your users will receive notifications when a newer version of the app is published. It can also prevent them from installing your app if the version they are currently using is the same as the version of the app hosted on your server.</p><h3>Summary</h3><p>I hope that you have enjoyed my 2 part series on iOS Ad Hoc Distribution! Do follow my Medium account for more iOS related articles!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e064776f6407" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Prepare, Host and Distribute Your iOS App for Ad-Hoc Distribution (Part 1 of 2)]]></title>
            <link>https://medium.com/@clarencechng/how-to-prepare-host-and-distribute-your-ios-app-for-ad-hoc-distribution-f8aba8e3cd10?source=rss-11a8efbbfe4c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8aba8e3cd10</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[ios-ad-hoc-distribution]]></category>
            <category><![CDATA[ios-ad-hoc]]></category>
            <category><![CDATA[ios-development]]></category>
            <dc:creator><![CDATA[Clarence Chng]]></dc:creator>
            <pubDate>Mon, 01 Aug 2022 06:07:52 GMT</pubDate>
            <atom:updated>2022-08-07T08:05:03.464Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pv_Izc6m-aHltyZgLQqptQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@maxcodes">Maxwell Nelson</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><h3>Introduction to iOS Ad-Hoc Distribution</h3><p>In this article, we will focus on Ad-Hoc Distribution and provide you with a comprehensive guide on how to prepare, host and distribute your very first app with your users.</p><p>Ad-Hoc distribution is a quick and easy way for developers to quickly distribute their apps for user testing without the need to go through the Apple App Store, which requires Apple’s approval for app listing. The developer can have their freedom in deciding how, where, when and who they want to distribute the app.</p><p><strong>Ways to Distribute iOS Apps Internally</strong></p><h4><strong>Apple TestFlight</strong></h4><ul><li>TestFlight is an easy to use solution for distributing apps to your clients without the need to physically access your client’s devices to deploy the application. It supports up to 1000 users and allows you to provide future updates of the application to all your users.</li><li>However, all apps submitted to TestFlight will be reviewed by Apple, a similar process for submitting an application to the App Store. Having said that, your app might be rejected if it does not adhere to Apple’s strict App Store policies. If time is of essence to you and your client, Ad-Hoc distribution would be the answer to your problem!</li></ul><h4><strong>Ad-Hoc Distribution</strong></h4><ul><li>Ad-Hoc Distribution allows you to have full control over who you want to distribute to, how you want the app to be distributed and when it can be distributed. The best part is, there is no need for any app review process by Apple and you can deploy it immediately to your users.</li><li>There are some limitations for Ad-Hoc Distribution. Firstly, Ad Hoc Distribution only works with devices registered in your Apple Developer Center account, which has a limit of 100 devices per category (eg. iPhone, iPad, Apple Watch etc). You will be required to obtain the <strong>Unique Device Identifier (UDID) </strong>of the devices you intend to distribute the apps on and register the UDID to your Apple Developer Center account. Furthermore, if you decide to host the application on your own Apache Web Server, Apple requires your Web Server to use a HTTPS connection to ensure security.</li></ul><p><strong>What we will be covering in this article</strong></p><ul><li>Creating a HelloWorld Application</li><li>Creating your certificate and provisioning profile from Apple Developer’s Portal</li><li>Exporting your Application into an .ipa file</li><li>Creating a LAMP server instance on DigitalOcean <strong>(Part 2 of article)</strong></li><li>Enabling HTTPS on our Apache Server using LetsEncrypt and CertBot <strong>(Part 2 of article)</strong></li><li>Distributing our iOS App on our Cloud Apache Server <strong>(Part 2 of article)</strong></li></ul><p><strong>What do you need?</strong></p><ul><li>Paid Apple Developer Program (USD99/year)</li><li>A Mac that supports recent versions of Xcode</li><li>Xcode (I’ll be using Xcode 13.4.1 in this article)</li><li>FileZilla <strong>(Part 2 of article)</strong></li><li>iOS Device (Preferably one that supports the latest version of iOS)</li><li>A domain name (eg. mywebhosting.com) <strong>(Part 2 of article)</strong></li><li>An Apache Web Server (I’ll be using a LAMP server instance running on DigitalOcean) <strong>(Part 2 of article)</strong></li><li>A valid SSL Certificate (Free if you own your domain name) <strong>(Part 2 of article)</strong></li></ul><h3><strong>Creating your Application</strong></h3><p>To begin, open up Xcode and select <strong>Create a new Xcode Project</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*WCzpb4UGL0EqdO5DDuHo4A.png" /><figcaption>Image by Author</figcaption></figure><p>Select <strong>App</strong>, and click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*8YdXblCmXz_7nwrK1uMmqQ.png" /><figcaption>Image by Author</figcaption></figure><p>Enter the following information</p><ul><li><strong>ProductName: <em>AdHocHelloWorld</em></strong></li><li><strong>Interface: <em>SwiftUI</em></strong></li></ul><p>Click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*LebaU-rmu_yEuSiAYHhGcw.png" /><figcaption>Image by Author</figcaption></figure><p>Choose your preferred directory to store this Xcode Project and select <strong>Create</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*JXFMAM0Ei_ZVOkWZSzLrIQ.png" /><figcaption>Image by Author</figcaption></figure><p>In <strong>ContentView.swift</strong>, modify the following codes:</p><pre><strong>struct</strong> ContentView: View {</pre><pre><strong>    var</strong> body: <strong>some</strong> View {</pre><pre>        Text(&quot;Hello World Ad Hoc!&quot;)</pre><pre>        .padding()</pre><pre>    }</pre><pre>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BGrV6lqV58M9h2hfP8Ocjg.png" /><figcaption>Image by Author</figcaption></figure><h3>Registering a Device to your iOS Developer Center</h3><p>To be able to distribute your app to your users, you will first need to obtain the <strong>Unique Device Identifier (UDID)</strong> of the device you intend to distribute the app to. To obtain the UDID, you will need to connect the device to your Mac and then open up Finder. On the left bar, select on your device and you should be presented with information about your device. Right under your device’s name, click on the red box area to display its UDID number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f3XDoo7cyZxQzL5Wy_Em0w.png" /><figcaption>Image by Author</figcaption></figure><p>You should now be able to see your UDID of that particular device (marked in the RED area). Save the UDID to a word document or Notepad as we will be using this information in a while.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TrEY92MUAzHjqMnm_im3XQ.png" /><figcaption>Image by Author</figcaption></figure><p>On your Browser, navigate to <a href="https://developer.apple.com/account/">Apple Developer Portal</a>, log in with your Apple ID that has a valid Paid Apple Developer Program.</p><p>On the left tab, click on <strong>Certificates, IDs &amp; Profiles</strong> and select on the <strong>Devices</strong> tab on the left</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vo3MSz8p-T69RaK8c36Seg.png" /><figcaption>Image by Author</figcaption></figure><p>If you have a newly registered Apple Developer’s account, you should have an empty list of registered device. Let us begin by registering the UDID of the device we have copied earlier. Click on the <strong>+ </strong>icon beside <strong>Device</strong>:</p><p>Specify a <strong>Device Name</strong> for your device (eg. Clarence’s iPhone) and paste in the UDID you copied earlier into the <strong>Device ID (UDID)</strong> field. Then click <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4znjroXHIlRGq2gNmvbfA.png" /><figcaption>Image By Author</figcaption></figure><p>Once the device has been added successfully, you should be able to see your device listed in the <strong>Devices</strong> table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ngH4eeja1u19oGFMUNIzg.png" /><figcaption>Image By Author</figcaption></figure><h3>Creating a Certificate</h3><p>On the same <strong>Certificates, IDs &amp; Profiles</strong> page, select on the <strong>Certificates</strong> tab on the left to show the <strong>Certificates</strong> page.</p><p>Before we can create a certificate for distributing our apps, we need to create a Certificate Signing Request (CSR). Apple’s official guide to create the CSR is in this <a href="https://help.apple.com/developer-account/#/devbfa00fef7">link</a>. Save the <strong>.certSigningRequest</strong> file that is generated from this process. We will be using this to generate our certificate for iOS Ad Hoc Distribution.</p><p>If you have a newly registered Apple Developer’s account, you should have an empty list of certificates. Let us begin by creating an iOS Distribution Certificate. Click on the <strong>+ </strong>icon beside <strong>Certificates</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OZpWPK0Gazq7MpoPhy4z_Q.png" /><figcaption>Image By Author</figcaption></figure><p>Select on <strong>Apple Distribution </strong>and select <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kr0POf8YCEnyvTeEoATEyw.png" /><figcaption>Image By Author</figcaption></figure><p>Select on <strong>Choose File</strong> and select on the <strong>.certSigningRequest </strong>file you have generated earlier and then select <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OSeKUA4mhehqdmKkhHzcjQ.png" /><figcaption>Image by Author</figcaption></figure><p>Once done, click on your iOS Distribution Certificate and click on <strong>Download</strong>. You will now have the <strong>.cer </strong>file on your computer. Double-click on the file to add it to your Keychain Access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EaJQqhqDMfFFr0RrClfdPw.png" /><figcaption>Image by Author</figcaption></figure><h3>Creating an App ID</h3><p>An App ID defines an identifier that identifies a group of app(s) permitted to be distributed. Note that it can be a unique app for an App ID, or it can be all the apps that you have that is represented by a wildcard (*) in your App ID.</p><p>If you have a newly registered Apple Developer’s account, you should have an empty list of Identifiers. Let us begin by creating an App ID solely for this AdHocHelloWorld application. Click on the <strong>+ </strong>icon beside <strong>Identifiers</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XlQxcO76YkDTlxRU_Br3pQ.png" /><figcaption>Image by Author</figcaption></figure><p>Next, select App IDs from the list of selections, and select <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*InV7Uv1hUb4GlgTWBmBHqg.png" /><figcaption>Image by Author</figcaption></figure><p>Choose <strong>App</strong>, and select <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nCpUZU8cpKQ7Z7TVOAWmqA.png" /><figcaption>Image by Author</figcaption></figure><p>In the Register an App ID page, enter the following information:</p><ul><li>Description: <strong>AdHocHelloWorld</strong></li><li>Bundle ID Type: <strong>Explicit Type</strong></li><li>Bundle ID: &lt;your_app’s_reverse_domain_name.AdHocHelloWorld&gt;</li></ul><p>Note: You will be able to find your Bundle Identifier in your Xcode Project as shown below:</p><p>In my case, my bundle identifier is <strong>com.clarencechng.AdHocHelloWorld</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V3gQlfCLdDRmrfevutv7Rw.png" /><figcaption>Image by Author</figcaption></figure><p>Once you have verified all the information is correct, select <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H9rJOGhrNywsvDC_e5JmEQ.png" /><figcaption>Image by Author</figcaption></figure><p>Apple will prompt you to verify the information once more, select <strong>Register</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UJRRACFwQFYm4NQMZHRwPQ.png" /><figcaption>Image by Author</figcaption></figure><p>You will now see that your App ID has been registered successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7_DlzclNSUZie5mwupsgtA.png" /><figcaption>Image by Author</figcaption></figure><h3>Creating a Provisioning Profile</h3><p>Finally, we are down to the last step before your app can be distributed to your users.</p><p>A provisioning profile is essentially a combination of all the things you have defined and created earlier, such as the certificate and App ID.</p><p>Provisioning Profile is made up of the following components:</p><ul><li><strong>App ID</strong> defines the set of app(s) that the Provisioning Profile is applicable for.</li><li><strong>Certificate</strong> defines the mode of distribution that the Provisioning Profile should use. Eg. App Store Publishing / Ad Hoc Distribution etc</li><li><strong>Approved Devices </strong>defines the devices that the app can be deployed to. It is a whitelisting process to ensure that only your intended user device(s) can get to access your app and not some random guy. This means that you can safely distribute your .ipa file online as the app can only be installed on approved devices. The app will not run on an unapproved devices.</li></ul><p>To begin, click on the <strong>Profiles</strong> tab on the left. If you have a newly registered Apple Developer’s account, you should have an empty list of Profiles. Let us begin by creating a Provisioning Profile solely for this AdHocHelloWorld application. Click on the <strong>+ </strong>icon beside <strong>Profiles</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8rylNzfd9RU_UdggV-mp-g.png" /><figcaption>Image by Author</figcaption></figure><p>Select <strong>Ad Hoc </strong>under <strong>Distribution Section</strong>, and then select <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lft514bIk2oi_WVroRDsXQ.png" /><figcaption>Image by Author</figcaption></figure><p>Select on the <strong>AdHocHelloWorld App ID</strong> that we have created earlier, and then select <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c3feqOg9hiQ_dzs-2Jk6cw.png" /><figcaption>Image by Author</figcaption></figure><p>Select the <strong>Distribution Certificate</strong> that we have created earlier. You should only see one with your name on it. Select the option and then select <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cf1IYrfM6dxbCwf3vA8UWg.png" /><figcaption>Image by Author</figcaption></figure><p>Finally choose on the device(s) that you want to distribute to, and then select <strong>Continue</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*famFAdCa83rfwH0GgRxU6A.png" /><figcaption>Image by Author</figcaption></figure><p>Name the Provisioning Profile as <strong>AdHocHelloWorld_PP </strong>and then select Generate</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ahm91jxPP88qSlMkUyFi-A.png" /><figcaption>Image by Author</figcaption></figure><p>Once it has been generated, click on <strong>Download</strong> to download the Provisioning Profile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Yo8B_RY14XthxYVR-MKwA.png" /><figcaption>Image by Author</figcaption></figure><p>Congratulations! You have now created a Provisioning Profile for your application and you are one step closer to your app distribution!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*NhjFAxQX0iTaXwTQuFFq_g.png" /><figcaption>Image by Author</figcaption></figure><h3>Preparing your Application for Distribution</h3><p>After having the provisioning profile, let us package our AdHocHelloWorld App for distribution.</p><p>On your Xcode Project, ensure that the device selected is <strong>Any iOS Device (arm64)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*BjNvpZ622TlfTjB1pCA9wA.png" /><figcaption>Image by Author</figcaption></figure><p>On Xcode’s menu bar, navigate to <strong>Product -&gt; Archive</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*g0QcWLcIG3cXXK6LpzrEUA.png" /><figcaption>Image by Author</figcaption></figure><p>You will see that your project will start the archiving process</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*GFDykWZ7-llcoC-31OGPhA.png" /><figcaption>Image by Author</figcaption></figure><p>As soon as the archival process is completed, Xcode will open up the <strong>Organizer </strong>window. The <strong>Organizer</strong> holds all the archived versions of your application. Now let’s select on <strong>Distribute App</strong> to generate the <strong>.ipa</strong> file of your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SjYsL9wFQ6GZLqTkG-vQqg.png" /><figcaption>Image by Author</figcaption></figure><p>Select on <strong>Ad Hoc</strong> and select <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*uE_h90CNqbRPTkJBxVaKZg.png" /><figcaption>Image by Author</figcaption></figure><p>In the Ad Hoc distribution options, uncheck the <strong>Include manifest for over-the-air installation </strong>and select <strong>Next</strong>.</p><blockquote><em>Note: We will revisit this </em><strong><em>Include manifest for over-the-air installation </em></strong><em>option in the second part of this article when we decide to host our .ipa file on a cloud server. For now we will uncheck it.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RUt0DGwbbW3bh7cSC9RlSw.png" /><figcaption>Image by Author</figcaption></figure><p>Select the <strong>Manually manage signing</strong> option and select <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*R4OKK-odPyZHVf36DzdJqQ.png" /><figcaption>Image by Author</figcaption></figure><p>Select on Import Profile</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*2p2xeDF3_4e92-vktbbpbg.png" /><figcaption>Image by Author</figcaption></figure><p>Select on the <strong>AdHocHelloWorld_PP.mobileprovision </strong>file you have downloaded earlier and select <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*JjxijhpdF6ELUpJPrAF3qA.png" /><figcaption>Image by Author</figcaption></figure><p>It will now start to compile and generate the ipa file of your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*xkmPGvHnDR1QjcZ6L5y2PA.png" /><figcaption>Image by Author</figcaption></figure><p>Lastly, you will be prompted to review on the details of your ipa file, select <strong>Export</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*PBgebAynRDiAJ66LMliLoA.png" /><figcaption>Image by Author</figcaption></figure><p>Save the package on a preferred location on your computer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*GdXvKIMkPf2QDS6P4QptOw.png" /><figcaption>Image by Author</figcaption></figure><p>Voila! You now have successfully completed the entire journey of an Ad-Hoc Application Distribution process!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/393/1*P4oDBqUqxlh1307MLrX70w.png" /><figcaption>Image by Author</figcaption></figure><p>You can now send your users / clients the .ipa file and they can install it directly on their devices that is registered in the provisioning profile.</p><h3>Installing the Application (Locally)</h3><p>Now your user must be over the moon when they received your .ipa file! The last step from trying out the application is the installation process.</p><p>To install the application, you must first connect the device to a mac. Open up Finder and locate your device. Drag and drop the ipa from the source folder into your devices’s Finder window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uNmCmCvjyb_FBI0TjBk45w.png" /><figcaption>Image by Author</figcaption></figure><p>On your device, you will see that the app is being installed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*bWl9ibuGbjaWu5Enpj8uyg.png" /><figcaption>Image by Author</figcaption></figure><p>Finally, once the installation is complete, tap on the app to launch it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*uc3tdgAEjfJCjEaFf_PA9Q.png" /><figcaption>Image by Author</figcaption></figure><p>You have now successfully created an app and distributed it to your users using the Ad-Hoc Distribution method! Congratulations! You’ve made it! This calls for a huge celebration!</p><h3>The next BIG question…</h3><p>Yay your users are now happy and now there’s a bigger challenge: there is a user that is in a different part of this world that wants to test out your app and he wants to test it NOW! You can’t possibly teleport to your user’s location right away?!?!</p><p>Fret not! There is a solution to distribute your .ipa remotely to your users worldwide through the use of an Apache Web Server. The web server will host our .ipa files and your users simply need the URL link of your web server to download the app directly on their devices.</p><p>In the next part of this article, I will show you how to create a cloud-based Apache Web Server using DigitalOcean services to host the files remotely. Stay tuned!</p><p>Part 2 of this article is completed! This is the <a href="https://medium.com/@clarencechng/how-to-prepare-host-and-distribute-your-ios-app-for-ad-hoc-distribution-part-2-of-2-e064776f6407">link</a> to my next article! Enjoy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8aba8e3cd10" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>