johnno1962 / InjectionIII

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

Symbol not found: _OBJC_CLASS_$_SwiftObject #145

Closed linshiqing closed 5 years ago

linshiqing commented 5 years ago

Bundle(path: "/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle")!.load()

Error loading /Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle/iOSInjection: dlopen(/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle/iOSInjection, 265): Symbol not found: _OBJCCLASS$_SwiftObject Referenced from: /Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle/iOSInjection Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/libswiftCore.dylib in /Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle/iOSInjection

johnno1962 commented 5 years ago

Is this an Objective-C project?

linshiqing commented 5 years ago

No, it is a Swift project。 It is "GettingStarted" from your website http://johnholdsworth.com/injection.html。 The Xcode Version is 10.2.1。 No matter Swift or Oc project I run, "dlopen" the bundle always get the similar result。 Could you give a version which has been adaptive to the Xcoe 10.2.1,thks!

johnno1962 commented 5 years ago

The version in the App store is adapted fro 10.2* Which bundle are you loading. It should be the one without the “10” suffix.

linshiqing commented 5 years ago

The bundle with "10" suffix still not success。 Error loading /Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10: dlopen(/Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10, 265): Symbol not found: _$SBOWV Referenced from: /Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10 Expected in:

johnno1962 commented 5 years ago

I’m not able to replicate your problem. Is your Xcode 10.2.1 at the path /Applications/Xcode.app?

linshiqing commented 5 years ago

Yes,the path is /Applications/Xcode.app。 I download the app from the AppStore and run the command "[[NSBundle bundleWithPath:@"/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle"] load];" again, it works and success , but if I modify the bundle to "iOSInjection10.bundle" it failed with the log ->" Error loading /Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10: dlopen(/Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10, 265): Symbol not found: _$SBOWV Referenced from: /Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10 Expected in: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftCore.dylib in /Applications/InjectionIII.app/Contents/Resources/iOSInjection10.bundle/iOSInjection10"

johnno1962 commented 5 years ago

/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle is the path you want to be using.

linshiqing commented 5 years ago

thks and I have another question :which is the Injection's latest version 1.5.2 ? Should we use InjectionIII or InjectionX。

johnno1962 commented 5 years ago

Sorry, you must have downloaded from the out of date link in the README.md. The most recent pre-release version is here: https://github.com/johnno1962/InjectionIII/releases/tag/1.5.2 (with a fix for storyboard injection on 10.2) but the App Store version is the supported version.

linshiqing commented 5 years ago

I see,thank you for your patience and explanation .