johnno1962 / injectionforxcode

Runtime Code Injection for Objective-C & Swift
MIT License
6.55k stars 565 forks source link

Environment failed to specify XCTestConfigurationFilePath #118

Closed yas375 closed 8 years ago

yas375 commented 8 years ago

First of thanks: thanks a lot for the great plugin :clap:

Sometimes when I'm injecting some code, it fails and closes the application. In console I see it complains about Environment failed to specify XCTestConfigurationFilePath. Not sure if it's expected that the plugin tries to specify something related to XCTest. Maybe it picks it up because I was editing some unit tests before? But I wasn't editing unit tests since I launched the app for sure.

Here is the entire log from console.

2016-04-01 00:15:05.717 CareZone[97682:19573430] Injection attempting connection to: 127.0.0.1:31442
2016-04-01 00:15:05.718 CareZone[97682:19573430] Connected to "Injection" plugin, ready to load x86_64 code.
Compiling /Users/yas/code/caremobile/Caremobile/MedicationViewController.m
        2.23 real         0.37 user         1.65 sys
... First time learning of project, one second ...
objc[97682]: Class ContactAutoCompletionObject is implemented in both /Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data/Containers/Bundle/Application/967FE4FD-94D6-4773-96BF-F98EA1295BB1/CareZone.app/CareZone and /Users/yas/code/caremobile/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle2.bundle/InjectionBundle. One of the two will be used. Which one is undefined.
objc[97682]: Class MedicationViewController is implemented in both /Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data/Containers/Bundle/Application/967FE4FD-94D6-4773-96BF-F98EA1295BB1/CareZone.app/CareZone and /Users/yas/code/caremobile/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle2.bundle/InjectionBundle. One of the two will be used. Which one is undefined.
2016-04-01 00:15:10.472 CareZone[97682:19568881] Environment failed to specify XCTestConfigurationFilePath.
2016-04-01 00:15:10.472 CareZone[97682:19568881] IDEBundleInjection Arguments: (
    "/Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data/Containers/Bundle/Application/967FE4FD-94D6-4773-96BF-F98EA1295BB1/CareZone.app/CareZone"
)
2016-04-01 00:15:10.473 CareZone[97682:19568881] IDEBundleInjection Environment: {
    "CFFIXED_USER_HOME" = "/Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data/Containers/Data/Application/EC27AF4C-8A78-471D-B49F-E0D7248083D3";
    "CFLOG_FORCE_STDERR" = YES;
    CLASSIC = 0;
    "CUPS_SERVER" = "/private/tmp/com.apple.launchd.NBjnTvzv87/Listeners";
    "DYLD_FALLBACK_FRAMEWORK_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks";
    "DYLD_FALLBACK_LIBRARY_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib";
    "DYLD_FRAMEWORK_PATH" = "/Users/yas/Library/Developer/Xcode/DerivedData/Caremobile-bvkpgrfszsplakgvzgeekswqpduj/Build/Products/Debug-iphonesimulator";
    "DYLD_LIBRARY_PATH" = "/Users/yas/Library/Developer/Xcode/DerivedData/Caremobile-bvkpgrfszsplakgvzgeekswqpduj/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/system/introspection";
    "DYLD_ROOT_PATH" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
    "DYLD_SHARED_REGION" = avoid;
    FBSClientLogging = 0;
    HOME = "/Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data/Containers/Data/Application/EC27AF4C-8A78-471D-B49F-E0D7248083D3";
    "IOS_SIMULATOR_SYSLOG_SOCKET" = "/private/tmp/com.apple.CoreSimulator.SimDevice.53F412F0-A71E-425D-9EEE-2140BF3702E8.launchd_sim/syslogsock";
    "IPHONE_SHARED_RESOURCES_DIRECTORY" = "/Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data";
    "IPHONE_SIMULATOR_CLASS" = N71;
    "IPHONE_SIMULATOR_DEVICE" = iPhone;
    "IPHONE_SIMULATOR_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
    "IPHONE_TVOUT_EXTENDED_PROPERTIES" = "/Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data/Library/Application Support/iPhone Simulator/com.apple.iphonesimulator/extended_display.plist";
    NSUnbufferedIO = YES;
    "OBJC_PRINT_EXCEPTIONS" = YES;
    PATH = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/local/bin";
    "SIMULATOR_CAPABILITIES" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/Profiles/DeviceTypes/iPhone 6s.simdevicetype/Contents/Resources/capabilities.plist";
    "SIMULATOR_DEVICE_NAME" = "iPhone 6s";
    "SIMULATOR_EXTENDED_DISPLAY_PROPERTIES" = "/Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data/Library/Application Support/iPhone Simulator/com.apple.iphonesimulator/extended_display.plist";
    "SIMULATOR_HOST_HOME" = "/Users/yas";
    "SIMULATOR_LEGACY_ASSET_SUFFIX" = iphone;
    "SIMULATOR_LOG_ROOT" = "/Users/yas/Library/Logs/CoreSimulator/53F412F0-A71E-425D-9EEE-2140BF3702E8";
    "SIMULATOR_MAINSCREEN_HEIGHT" = 1334;
    "SIMULATOR_MAINSCREEN_PITCH" = "326.000000";
    "SIMULATOR_MAINSCREEN_SCALE" = "2.000000";
    "SIMULATOR_MAINSCREEN_WIDTH" = 750;
    "SIMULATOR_MEMORY_WARNINGS" = "/Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data/var/run/memory_warning_simulation";
    "SIMULATOR_MODEL_IDENTIFIER" = "iPhone8,1";
    "SIMULATOR_PLATFORM_RUNTIME_OVERLAY_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/CoreSimulator/RuntimeOverlay";
    "SIMULATOR_ROOT" = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk";
    "SIMULATOR_RUNTIME_BUILD_VERSION" = 13E230;
    "SIMULATOR_RUNTIME_VERSION" = "9.3";
    "SIMULATOR_SHARED_RESOURCES_DIRECTORY" = "/Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data";
    "SIMULATOR_UDID" = "53F412F0-A71E-425D-9EEE-2140BF3702E8";
    "SIMULATOR_VERSION_INFO" = "CoreSimulator 209.19 - Device: iPhone 6s - Runtime: iOS 9.3 (13E230) - DeviceType: iPhone 6s";
    "TESTMANAGERD_SIM_SOCK" = "/private/tmp/com.apple.launchd.oeqX62b2sK/com.apple.testmanagerd.unix-domain.socket";
    TMPDIR = "/Users/yas/Library/Developer/CoreSimulator/Devices/53F412F0-A71E-425D-9EEE-2140BF3702E8/data/Containers/Data/Application/EC27AF4C-8A78-471D-B49F-E0D7248083D3/tmp";
    "XPC_FLAGS" = 0x0;
    "XPC_SERVICE_NAME" = "UIKitApplication:com.something[0xc5c1]";
    "XPC_SIMULATOR_LAUNCHD_NAME" = "com.apple.CoreSimulator.SimDevice.53F412F0-A71E-425D-9EEE-2140BF3702E8.launchd_sim";
    "__XCODE_BUILT_PRODUCTS_DIR_PATHS" = "/Users/yas/Library/Developer/Xcode/DerivedData/Caremobile-bvkpgrfszsplakgvzgeekswqpduj/Build/Products/Debug-iphonesimulator";
    "__XPC_DYLD_FRAMEWORK_PATH" = "/Users/yas/Library/Developer/Xcode/DerivedData/Caremobile-bvkpgrfszsplakgvzgeekswqpduj/Build/Products/Debug-iphonesimulator";
    "__XPC_DYLD_LIBRARY_PATH" = "/Users/yas/Library/Developer/Xcode/DerivedData/Caremobile-bvkpgrfszsplakgvzgeekswqpduj/Build/Products/Debug-iphonesimulator";
}
johnno1962 commented 8 years ago

Not seen that before. Do you have a -injected method in the classes being injected? If so, try removing it.

yas375 commented 8 years ago

I don't have implemented injected methods.

johnno1962 commented 8 years ago

Not sure what this IDEBundleInjection business is. It seems to be getting confused with your tests. More than this I can’t really say.

johnno1962 commented 8 years ago

Interesting, I’ve just got this error myself :(

yas375 commented 8 years ago

It looks like removing derived data helps. But it's probably just a workaround, not a solution.

rm -rf ~/Library/Developer/Xcode/DerivedData
johnno1962 commented 8 years ago

You’re using 7.3?

yas375 commented 8 years ago

Yes.

Xcode 7.3 (7D175) OS X 10.11.4 (15E65)

johnno1962 commented 8 years ago

Well, you can get it to work by deleteing your tests!

yas375 commented 8 years ago

I always knew I don't need any tests!

On Fri, Apr 1, 2016 at 2:54 PM, John Holdsworth notifications@github.com wrote:

Well, you can get it to work by deleteing your tests!

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/johnno1962/injectionforxcode/issues/118#issuecomment-204583015

Victor Ilyukevich. @yas375

johnno1962 commented 8 years ago

Can you update your plugin (unload and load in Alcatraz or downlaod and build) and try now? I’ve made a minor change that seems to resolve this. There was a framework IDEBundleInjection.framework in the app package which if you remove it when you inject makes this problem go away.

yas375 commented 8 years ago

@johnno1962 great job! The issue seem to gone!

Here is what I did:

Given: plugin works.

  1. I run unit tests
  2. verified that the plugin has started to fail
  3. remove the plugin in Alcatraz. Restart the Xcode
  4. reinstall the plugin. Restart the Xcode
  5. And it works!!

I'll keep an eye on it, but this can be closed now. Thanks John!