Closed Esqarrouth closed 9 years ago
// From here to end of file added by Injection Plugin // ifdef DEBUG static char _inMainFilePath[] = FILE; static const char *_inIPAddresses[] = {"127.0.0.1", "192.168.1.106", 0}; define INJECTION_ENABLED import "/Users/gok2/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/BundleInjection.h" endif
// From here to end of file added by Injection Plugin //
static char _inMainFilePath[] = FILE; static const char *_inIPAddresses[] = {"127.0.0.1", "192.168.1.106", 0};
Trying something simple like this:
override func viewDidAppear(animated: Bool) { view.backgroundColor = UIColor.greenColor() }
Then changing the color to red after the first compile and injecting.
Xcode log:
2015-07-15 00:16:58.252 heyyy[31126:1205322] +[BundleInjection load] 127.0.0.1 (see project's main.(m|mm) 2015-07-15 00:16:58.256 heyyy[31126:1205346] Injection attempting connection to: 127.0.0.1:31442 2015-07-15 00:16:58.260 heyyy[31126:1205346] Connected to "Injection" plugin, ready to load x86_64 code. 2015-07-15 00:17:19.462 heyyy[31126:1205322] Swizzled heyyy.ViewController 0x11b826420 -> 0x10e6fe2a0
Injection console:
Disconnected from: /Users/gok2/Library/Developer/CoreSimulator/Devices/E06A6A92-BE0A-4DE3-A5C0-97F6F7D55E8E/data/Containers/Bundle/Application/7D177E16-F042-4792-9C79-412BB6650FA0/heyyy.app/heyyy Connection from: /Users/gok2/Library/Developer/CoreSimulator/Devices/E06A6A92-BE0A-4DE3-A5C0-97F6F7D55E8E/data/Containers/Bundle/Application/D39F34EF-E7E9-4183-8E26-F5E6E6A936C8/heyyy.app/heyyy x86_64 (54) Disconnected from: /Users/gok2/Library/Developer/CoreSimulator/Devices/E06A6A92-BE0A-4DE3-A5C0-97F6F7D55E8E/data/Containers/Bundle/Application/D39F34EF-E7E9-4183-8E26-F5E6E6A936C8/heyyy.app/heyyy Connection from: /Users/gok2/Library/Developer/CoreSimulator/Devices/E06A6A92-BE0A-4DE3-A5C0-97F6F7D55E8E/data/Containers/Bundle/Application/D61BDA03-E7AD-4847-A47D-786EF8DE0D07/heyyy.app/heyyy x86_64 (54) Patching project contained in: /Users/gok2/Documents/heyyy/ Learnt compile: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/gok2/Documents/heyyy/heyyy/ViewController.swift /Users/gok2/Documents/heyyy/heyyy/AppDelegate.swift -target x86_64-apple-ios8.4 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -I /Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Products/Debug-iphonesimulator -F /Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Products/Debug-iphonesimulator -g -import-objc-header /Users/gok2/Documents/heyyy/heyyy/heyyy-Bridging-Header.h -module-cache-path /Users/gok2/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/heyyy-generated-files.hmap -Xcc -I/Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/heyyy-own-target-headers.hmap -Xcc -I/Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/heyyy-all-target-headers.hmap -Xcc -iquote -Xcc /Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/heyyy-project-headers.hmap -Xcc -I/Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Products/Debug-iphonesimulator/include -Xcc -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/DerivedSources/x86_64 -Xcc -I/Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/DerivedSources -Xcc -DDEBUG=1 -DINJECTION_BUNDLE -Xcc -working-directory/Users/gok2/Documents/heyyy -emit-module-doc-path /Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/Objects-normal/x86_64/ViewController~partial.swiftdoc -Onone -module-name heyyy -emit-module-path /Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/Objects-normal/x86_64/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/Objects-normal/x86_64/ViewController.dia -emit-dependencies-path /Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/Objects-normal/x86_64/ViewController.d -emit-reference-dependencies-path /Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/Objects-normal/x86_64/ViewController.swiftdeps -o /Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Intermediates/heyyy.build/Debug-iphonesimulator/heyyy.build/Objects-normal/x8664/ViewController.o real 0m0.422s user 0m0.347s sys 0m0.054s ls: .framework: No such file or directory Building iOSInjectionProject/InjectionBundle.xcodeproj bash ../iOSInjectionProject/x86_64/compile_commands.sh # xcodebuild -configuration Debug -arch x86_64 -sdk iphonesimulator /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/var/folders/zh/7q55mh657ggdfxt0dwy45rs80000gn/C/org.llvm.clang/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wmissing-prototypes -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -fexceptions -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=8.4 -iquote /Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/InjectionBundle-generated-files.hmap -I/Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/InjectionBundle-own-target-headers.hmap -I/Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/InjectionBundle-all-target-headers.hmap -iquote /Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/InjectionBundle-project-headers.hmap -iquote.. -I/Users/gok2/Documents/heyyy/iOSInjectionProject/build/Debug-iphonesimulator/include -I../heyyy -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk/usr/include/libxml2 -I/Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/DerivedSources/x86_64 -I/Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/DerivedSources -F/Users/gok2/Documents/heyyy/iOSInjectionProject/build/Debug-iphonesimulator -include /var/folders/zh/7q55mh657ggdfxt0dwy45rs80000gn/C/com.apple.DeveloperTools/6.4-6E35b/Xcode/SharedPrecompiledHeaders/InjectionBundle-Prefix-edpresamcrbvwscwmwijvphhlhiv/InjectionBundle-Prefix.pch -MMD -MT dependencies -MF /Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/Objects-normal/x86_64/BundleContents.d —serialize-diagnostics /Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/Objects-normal/x86_64/BundleContents.dia -c /Users/gok2/Documents/heyyy/iOSInjectionProject/BundleContents.m -o /Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/Objects-normal/x86_64/BundleContents.o real 0m0.724s user 0m0.041s sys 0m0.533s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -L/Users/gok2/Documents/heyyy/iOSInjectionProject/build/Debug-iphonesimulator -F/Users/gok2/Documents/heyyy/iOSInjectionProject/build/Debug-iphonesimulator -filelist /Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/Objects-normal/x86_64/InjectionBundle.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 x86_64/injecting_class.o -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -F/Users/gok2/Library/Developer/Xcode/DerivedData/heyyy-heegnynpaveekngjnytitwypwqvd/Build/Products/Debug-iphonesimulator -undefined dynamic_lookup -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=8.4 -framework UIKit -framework QuartzCore -framework OpenGLES -framework Foundation -framework CoreGraphics -Xlinker -dependency_info -Xlinker /Users/gok2/Documents/heyyy/iOSInjectionProject/build/InjectionBundle.build/Debug-iphonesimulator/InjectionBundle.build/Objects-normal/x86_64/InjectionBundle_dependencyinfo.dat -o /Users/gok2/Documents/heyyy/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle.bundle/InjectionBundle real 0m0.066s user 0m0.039s sys 0m0.023s /usr/bin/touch -c “/Users/gok2/Documents/heyyy/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle.bundle” * RECORDED BUILD SUCCEEDED ** Renaming bundle so it reloads.. rm -rf “/Users/gok2/Documents/heyyy/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle3.bundle” && cp -r “/Users/gok2/Documents/heyyy/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle.bundle” “/Users/gok2/Documents/heyyy/iOSInjectionProject/build/Debug-iphonesimulator/InjectionBundle3.bundle” Loading Bundle… Bundle loaded successfully
I am expecting green to turn to red, but it doesn't. What am I missing here?
Looks ok to me. Is viewDidAppear being called? i.e. are you reloading the view?
I was, but it seems not properly. Fixed it kind of my bad. Thanks anyways!
Trying something simple like this:
Then changing the color to red after the first compile and injecting.
Xcode log:
Injection console:
I am expecting green to turn to red, but it doesn't. What am I missing here?