Skip to content

Commit

Permalink
Re-instate codesigning for injection on an iOS a device.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnno1962 committed Mar 6, 2024
1 parent c5012cb commit 119af19
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 35 deletions.
2 changes: 1 addition & 1 deletion HotReloading
2 changes: 1 addition & 1 deletion InjectionIII/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>7988</string>
<string>7995</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
3 changes: 1 addition & 2 deletions InjectionIII/build_bundles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Created by John Holdsworth on 04/10/2019.
# Copyright © 2019 John Holdsworth. All rights reserved.
#
# $Id: //depot/ResidentEval/InjectionIII/build_bundles.sh#87 $
# $Id: //depot/ResidentEval/InjectionIII/build_bundles.sh#88 $
#

# Injection has to assume a fixed path for Xcode.app as it uses
Expand Down Expand Up @@ -44,7 +44,6 @@ function build_bundle () {
#build_bundle macOS MacOSX macosx &&
if [ "$(hostname)" != "Johns-MacBook-Air.local" ]; then
build_bundle xrOS XRSimulator xrsimulator
build_bundle xrdevOS XROS xros
fi
build_bundle iOS iPhoneSimulator iphonesimulator &&
build_bundle tvOS AppleTVSimulator appletvsimulator &&
Expand Down
38 changes: 7 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,40 +134,18 @@ of the InjectionIII.app, set a user default to opt-in and restart the app.
```
$ defaults write com.johnholdsworth.InjectionIII deviceUnlock any
```
Then, instead of loading the injection bundles run this script in a "Build Phase":

```
RESOURCES=/Applications/InjectionIII.app/Contents/Resources
if [ -f "$RESOURCES/copy_bundle.sh" ]; then
"$RESOURCES/copy_bundle.sh"
fi
```
and, in your application execute the following code on startup:

```
#if DEBUG
if let path = Bundle.main.path(forResource:
"iOSInjection", ofType: "bundle") ??
Bundle.main.path(forResource:
"macOSInjection", ofType: "bundle") {
Bundle(path: path)!.load()
}
#endif
```
Once you have switched to this configuaration it will also
work when using the simulator. Consult the README of the
[HotReloading project](https://github.com/johnno1962/HotReloading)
for details on how to debug having your program connect to the
Then, instead of loading the injection bundles add the following
Swift Package to your project (*only during development*):
[HotReloading project](https://github.com/johnno1962/HotReloading).
This contains details on how to debug having your program connect to the
InjectionIII.app over Wi-Fi. You will also need to select the project
directory for the file watcher manually from the pop-down menu.

### Injection on macOS

It works but you need to temporarily turn off the "app sandbox" and
"library validation" under the "hardened runtime" during development
so it can dynamically load code. In order to avoid codesigning problems,
use the new `copy_bundle.sh` script as detailed in the instructions for
injection on an iOS device above.
so it can dynamically load code.

### How it works

Expand Down Expand Up @@ -231,9 +209,7 @@ file system to be a faithful simulation of a real device.
and because you cannot load a bundle off your Mac's filesystem on a real
phone you add the [HotReloading Swift Package](https://github.com/johnno1962/HotReloading)
to your project (during development only!) which contains all the code that
would normally be in the bundle to perform the dynamic loading. This
requires that you use one of the un-sandboxed binary releases. It has
also been replaced by the `copy_bundle.sh` script described above.
would normally be in the bundle to perform the dynamic loading.

"Standalone injection". This was the most recent evolution of the project
where you don't run the app itself anymore but simply load one of the
Expand Down Expand Up @@ -292,4 +268,4 @@ for the code to be evaluated using injection under an MIT license.

The fabulous app icon is thanks to Katya of [pixel-mixer.com](http://pixel-mixer.com/).

$Date: 2024/01/28 $
$Date: 2024/03/06 $

0 comments on commit 119af19

Please sign in to comment.