johnno1962 / InjectionApp

Issue Tracking Repo for Injection as an App
MIT License
111 stars 7 forks source link

Bundle Load Error for one project but works like a charm with another #29

Closed zenangst closed 6 years ago

zenangst commented 7 years ago

Hey @johnno1962, its me again.

I'm trying to include injection in a new project but I'm running into issues with the following message being printed to the Xcode console.

Compiling /path_to_project/Sources/App/Product/Views/ProductDetailView.swift
2017-06-22 18:03:07.078 AppName[9671:32553096] Error loading /Users/christofferwinterkvist/Library/Developer/Xcode/DerivedData/AppName-cwvdgrwmxnmakuatnawasnzuqqxm/Logs/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle134.bundle/InjectionBundle:  dlopen(/Users/christofferwinterkvist/Library/Developer/Xcode/DerivedData/AppName-cwvdgrwmxnmakuatnawasnzuqqxm/Logs/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle134.bundle/InjectionBundle, 265): Symbol not found: ___llvm_profile_runtime
  Referenced from: /Users/christofferwinterkvist/Library/Developer/Xcode/DerivedData/AppName-cwvdgrwmxnmakuatnawasnzuqqxm/Logs/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle134.bundle/InjectionBundle
  Expected in: flat namespace
 in /Users/christofferwinterkvist/Library/Developer/Xcode/DerivedData/AppName-cwvdgrwmxnmakuatnawasnzuqqxm/Logs/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle134.bundle/InjectionBundle
2017-06-22 18:03:07.079 AppName[9671:32553096] Bundle Load Error
2017-06-22 18:03:07.079 AppName[9671:32553164] *** Bundle has failed to load. If this is due to symbols not found, this may be due to symbols being hidden from dynamic libraries. ***
5 injections performed so far.

I'm using the new Xcode 9 beta 2 (+ the injection app version for the beta) on macOS Sierra.

zenangst commented 7 years ago

I've tried to compare the two projects to iron out if there are any differences in build settings but I've come up empty handed so far.

johnno1962 commented 7 years ago

Hmmm. The betas are still a bit of an unknown quantity. I’ve had mixed results so far. Have you looked at if there are differences in the bundle projects/recreated them?

zenangst commented 7 years ago

I tried removing everything in derived data just to be sure that nothing spooky was going on there. Both bundle project build like they should. I'm gonna do some further investigation to see what is actually going on. I'll keep you posted!

johnno1962 commented 6 years ago

ok, this seems to be to do with whether the tests of your project are gathering coverage data. Turn it off and this error should go away. Also, you need to make any “injected()” methods @objc in Swift4.

johnno1962 commented 6 years ago

I’ve uploaded a new version of injection for Xcode 9 with various workarounds to http://johnholdsworth.com/Injection9.app.zip if you want to try it out. Not much has changed except it’s now important for the injected file to be the most recently modified open Xcode document.