ios: link Network/CoreFoundation/Foundation/objc/iconv for the iroh staticlib

The iroh xcframework needs more system frameworks than the legacy build: iroh's
netwatch uses Network.framework (nw_* symbols), and the objc2 bindings pull in
CoreFoundation/Foundation/objc/iconv. Add them to OTHER_LDFLAGS so TetherApp
links against the iroh core (verified: arm64 simulator BUILD SUCCEEDED; harmless
extra frameworks for the legacy build too).

Also add examples/iroh_send.rs — a one-shot test sender to pre-flight the agent's
receive path (clipboard write + provenance toast) without a second device.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-22 01:45:11 -05:00
parent 33c577357c
commit 1487ac4cb9
2 changed files with 40 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
//! One-shot test sender — stands in for "another device" to pre-flight the
//! agent's receive path (write clipboard + provenance toast) before testing from
//! the phone.
//! TETHER_RENDEZVOUS=http://IP:8765 cargo run --features iroh-transport \
//! --example iroh_send -- "text to send" [account]
//! Joins the same account-derived room via the rendezvous and sends one clipboard.
use std::time::Duration;
use tethercore::{room_for_account, Engine, Message, MessageHandler};
struct Noop;
impl MessageHandler for Noop {
fn on_message(&self, _m: Message) {}
fn on_status(&self, _c: bool) {}
fn on_file(&self, _n: String, _m: String, _d: Vec<u8>) {}
}
fn main() {
let text = std::env::args().nth(1).unwrap_or_else(|| "hello from a fake phone 📋".into());
let account = std::env::args().nth(2).unwrap_or_else(|| "pecord@gmail.com".into());
let server = std::env::var("TETHER_RENDEZVOUS").unwrap_or_else(|_| "http://localhost:8765".into());
let room = room_for_account(account.clone());
eprintln!("sender → rendezvous {server}, room {room}, account {account}");
let e = Engine::new(server, room, "preflight-sender".into(), "ios".into(), "Test iPhone".into(), account);
e.start(Box::new(Noop));
eprintln!("joining topic + discovering the agent…");
std::thread::sleep(Duration::from_secs(8));
eprintln!("sending: {text:?}");
e.send(text);
std::thread::sleep(Duration::from_secs(4)); // let gossip deliver
e.stop();
eprintln!("done — check the Mac clipboard + notification");
}

View File

@@ -22,8 +22,10 @@ targets:
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: io.pecord.tether
# Rust staticlib pulls in SecRandomCopyBytes (ring) + system config (reqwest).
OTHER_LDFLAGS: "-framework Security -framework SystemConfiguration -lresolv"
# Rust staticlib pulls in SecRandomCopyBytes (ring) + system config
# (reqwest) + iroh's netwatch (Network.framework) + objc2 bindings
# (CoreFoundation/Foundation/objc) + iconv.
OTHER_LDFLAGS: "-framework Security -framework SystemConfiguration -framework Network -framework CoreFoundation -framework Foundation -lobjc -liconv -lresolv"
MARKETING_VERSION: "0.1.0"
CURRENT_PROJECT_VERSION: "1"
GENERATE_INFOPLIST_FILE: true