Files
firezone/swift/apple
Jamil 2cdd30437b refactor(apple): Collapse SwiftUI codepaths across platforms and remove dead code (#4417)
~~Had to do another big round of ball-of-yarn untangling in order to
create two auth flows for iOS / macOS.~~

~~This is required because of App Store guidelines.~~

Edit: Appeal filed. There seems to be no good way to have a nice
browser-based auth experience without using ASWebAuthenticationSession.
The last resort would be to open a normal browser tab and push the
client's token over an unauthenticated websocket channel from the portal
to the client.

This PR is now just to clean up the SwiftUI mess.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-04-04 04:20:47 +00:00
..
2023-10-16 19:02:12 +00:00
2024-03-08 01:55:27 +00:00

Firezone Apple Client

Firezone clients for macOS and iOS.

Pre-requisites

  1. Rust: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Request your Firezone email added to our Apple Developer Account
  3. Open Xcode, go to Settings -> Account and log in. Click "Download manual profiles" button.
  4. Install signing keys from 1password "Engineering" vault.

Automatic signing has been disabled because it doesn't easily work with our CI/CD pipeline.

Building

  1. Clone this repo:

    git clone https://github.com/firezone/firezone
    
  2. cd to the Apple clients code

    cd swift/apple
    
  3. Copy an appropriate xcconfig and edit as necessary:

    cp Firezone/xcconfig/debug.xcconfig Firezone/xcconfig/config.xcconfig
    vim Firezone/xcconfig/config.xcconfig
    
  4. Open project in Xcode:

open Firezone.xcodeproj
  1. Build the Firezone target

Debugging

This Network Extension debugging guide is a great resource to use as a starting point.

Debugging on ios simulator

Network Extensions can't be debugged in the iOS simulator, so you'll need a physical iOS device or Mac to debug.

NetworkExtension not loading (macOS)

Try clearing your LaunchAgent db:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -delete

Note: You MUST reboot after doing this!

Outdated version of NetworkExtension loading

If you're making changes to the Network Extension and it doesn't seem to be reflected when you run/debug, it could be that PluginKit is still launching your old NetworkExtension. Try this to remove it:

pluginkit -v -m -D -i <bundle-id>
pluginkit -a <path>
pluginkit -r <path>

Cleaning up

Occasionally you might encounter strange issues where it seems like the artifacts being debugged don't match the code, among other things. In these cases it's good to clean up using one of the methods below.

Resetting Xcode package cache

Removes cached packages, built extensions, etc.

rm -rf ~/Library/Developer/Xcode/DerivedData

Removing build artifacts

To cleanup Swift build objects:

cd swift/apple
./cleanup.sh

To cleanup both Swift and Rust build objects:

cd swift/apple
./cleanup.sh all

Wiping connlib log directory

rm -rf $HOME/Library/Group\ Containers/47R2M6779T.group.dev.firezone.firezone/Library/Caches/logs/connlib

Clearing the Keychain item

Sometimes it's helpful to be able to test how the app behaves when the keychain item is missing. You can remove the keychain item with the following command:

security delete-generic-password -s "dev.firezone.firezone"