johnno1962 / InjectionIII

Re-write of Injection for Xcode in (mostly) Swift
MIT License
4.08k stars 319 forks source link

Injection doesn't work with Xcode 15.2 #480

Closed wojciech-kulik closed 9 months ago

wojciech-kulik commented 9 months ago

Injection stopped working with the new Xcode:

💉 ⚠️ Re-compilation failed (see: /Users/wkulik/Library/Containers/com.johnholdsworth.InjectionIII/Data/tmp/command.sh)
<unknown>:0: error: cannot open file '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.2.sdk/usr/include/Dispatch/module.modulemap': No such file or directory
<unknown>:0: error: cannot load underlying module for 'Dispatch'
johnno1962 commented 9 months ago

Hi, I've not had any problems with 15.2 as yet. There are a few things you can try though. Start by closing and re-opening your project to clear out old build logs and perhaps a build clean. Injection also has a cache though it should invalidate automatically. You can remove it using rm /tmp/*builds.plist or rebooting. Is this a project that contains Objective-C?

wojciech-kulik commented 9 months ago

I fixed the problem! It turned out that it was caused by import Dispatch. I replaced it with import Foundation and now it works great :). Thank you for the support!

johnno1962 commented 9 months ago

Interesting!

wojciech-kulik commented 9 months ago

@johnno1962 btw. this file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.2.sdk/usr/include/Dispatch/module.modulemap) exists but it's lowercased dispatch, so probably that's the bug.

johnno1962 commented 9 months ago

Aha, so you must be using "standalone" injection or the App Store version of the app which compiles in the simulator which is case sensitive. If you use one of the GitHub releases of the app this shouldn't occur.

wojciech-kulik commented 9 months ago

Yes, I used the one from the App Store. What are the differences between these two?

johnno1962 commented 9 months ago

The only difference is the sandbox which means compilation has to be delegated to the simulator.

wojciech-kulik commented 9 months ago

Is then the GitHub version faster?

johnno1962 commented 9 months ago

I don't think so though I've never checked. The simulator just has this peculiarity. They must have renamed the directory with Xcode 15.2. I wonder if this issue will come up again and if so if there anything I can do about it.

johnno1962 commented 9 months ago

Can you post the contents of the command.sh file it mentions or email it to me at github at johnholdsworth.com?