Skip to content

Issue injecting on real device – Code signature invalid & Unhide Symbols restart loop #81

@tenismiguel

Description

@tenismiguel

Hi John, first of all thanks for your amazing tool.

I'm having a persistent issue when trying to use InjectionNext while running my app on a real device (iPhone 16 running iOS 18.6), using Xcode 16.0.

Context:
Target device: iPhone 16 (iOS 18.6)

Xcode version: 16.0 (stable)

InjectionNext: latest release from Gumroad

Project type: SwiftUI iOS app

Compilation mode: Incremental (not Whole Module)

EMIT_FRONTEND_COMMAND_LINES: Enabled = YES in build settings

The problem:
When I try to inject changes into my app, the connection seems to be established and recompilation appears to start, but then I get persistent dlopen errors about invalid code signature on the generated .dylib. Here's an excerpt from the logs:

🔥 InjectionNext: Locating developer's Mac. Have you selected "Enable Devices"?
Broadcasting to pdp_ip1#4:5.57.7.41 to locate Injection host...
SimpleSocket/Could not send broadcast ping: No route to host
Broadcasting to en2#15:169.254.255.255 to locate Injection host...
...
🔥 Connecting to iMac-de-Miguel.home (169.254.67.84)...
🔥 InjectionNext: iPhoneOS connection to app established, waiting for commands.
🔥 Recompiling: /Users/miguel/Documents/StockManager/StockManager/ContentView.swift
🔥 ⚠️ dlopen failed dlopen(/private/var/mobile/Containers/Data/Application/.../tmp/eval_injection_ContentView_1.dylib, 0x0002): ... code signature invalid ... errno=1 ...
🔥 Injection could not load. If this was due to a default argument. Select the app's menu item "Unhide Symbols".
I tried using the “Unhide Symbols” option as recommended. It says:

🔥 0 symbols exported in 542 object files, please restart your app.
But even after restarting the app and trying again, I always get the same error — it's like I'm stuck in a loop where the code signature is always rejected.

Code setup
Here’s my current ContentView.swift:

import SwiftUI
import InjectionNext
import HotSwiftUI

struct ContentView: View {
@ObserveInjection private var inject

var body: some View {
    Text("Hola buenas")
        // .onReceive(InjectionNext.notification) {
        //     inject.invalidate()
        // }
}

}
And my main entry point:

swift
Copiar
Editar
import SwiftUI
import FirebaseCore

class AppDelegate: NSObject, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
FirebaseApp.configure()
return true
}
}

@main
struct StockManagerApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate

var body: some Scene {
    WindowGroup {
        ContentView()
    }
}

}

What I've tried so far:
Manually re-signing the app binary with my Apple Development certificate using codesign --force --deep ...

Confirmed valid entitlements

Verified dylib is generated at expected path, but code signature always fails

Cleaned build folder & rebuilt

Recompiled with file edits

Confirmed EMIT_FRONTEND_COMMAND_LINES is working

Disabled Whole Module Optimization

What I'm asking:
Is there anything else I can try to make InjectionNext work with real devices under iOS 18.6 and Xcode 16.0?

I’d really appreciate any pointers, or if there's a fix or workaround you could suggest. I’d love to continue using InjectionNext on-device for faster iteration.

Thanks a lot for your help!

Miguel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions