Open simpzan opened 7 years ago
You could try “patched injection” in the extension code somehow (e.g. give the target a main.m and have it patched)
I tried the patched injection described here, and got following compile error. https://github.com/johnno1962/injectionforxcode/blob/master/documentation/patching_injection.md
Showing All Messages
CompileC /Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/Debug-iphoneos/PacketTunnel-iOS.build/Objects-normal/arm64/main.o PacketTunnel-iOS/main.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/simpzan/repo/Escalade
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-cache-path=/Users/simpzan/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/simpzan/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -fapplication-extension -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Wno-implicit-atomic-properties -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -miphoneos-version-min=9.3 -g -Wno-sign-conversion -Winfinite-recursion -fembed-bitcode-marker -iquote /Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/Debug-iphoneos/PacketTunnel-iOS.build/PacketTunnel-iOS-generated-files.hmap -I/Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/Debug-iphoneos/PacketTunnel-iOS.build/PacketTunnel-iOS-own-target-headers.hmap -I/Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/Debug-iphoneos/PacketTunnel-iOS.build/PacketTunnel-iOS-all-non-framework-target-headers.hmap -ivfsoverlay /Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/all-product-headers.yaml -iquote /Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/Debug-iphoneos/PacketTunnel-iOS.build/PacketTunnel-iOS-project-headers.hmap -I/Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Products/Debug-iphoneos/include -I/Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/Debug-iphoneos/PacketTunnel-iOS.build/DerivedSources/arm64 -I/Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/Debug-iphoneos/PacketTunnel-iOS.build/DerivedSources -F/Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Products/Debug-iphoneos -F/Users/simpzan/repo/Escalade/NEKit/Carthage/Build/iOS -MMD -MT dependencies -MF /Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/Debug-iphoneos/PacketTunnel-iOS.build/Objects-normal/arm64/main.d --serialize-diagnostics /Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/Debug-iphoneos/PacketTunnel-iOS.build/Objects-normal/arm64/main.dia -c /Users/simpzan/repo/Escalade/PacketTunnel-iOS/main.m -o /Users/simpzan/Library/Developer/Xcode/DerivedData/Escalade-dypepldqwsvdzwgnmuihlclmjomq/Build/Intermediates/Escalade.build/Debug-iphoneos/PacketTunnel-iOS.build/Objects-normal/arm64/main.o
In file included from /Users/simpzan/repo/Escalade/PacketTunnel-iOS/main.m:16:
In file included from /tmp/injectionforxcode/BundleInjection.h:96:
/tmp/injectionforxcode/BundleSweeper.h:48:41: error: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
UIApplication *app = [UIApplication sharedApplication];
^
In module 'UIKit' imported from /tmp/injectionforxcode/IvarAccess.h:61:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:108:54: note: property 'sharedApplication' is declared unavailable here
@property(class, nonatomic, readonly) UIApplication *sharedApplication NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.");
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:108:54: note: 'sharedApplication' has been explicitly marked unavailable here
In file included from /Users/simpzan/repo/Escalade/PacketTunnel-iOS/main.m:16:
/tmp/injectionforxcode/BundleInjection.h:922:51: error: 'initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:' is unavailable: not available on iOS (App Extension) - Use UIAlertController instead.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Bundle Loaded"
^
In module 'UIKit' imported from /tmp/injectionforxcode/IvarAccess.h:61:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIAlertView.h:28:1: note: 'initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:' has been explicitly marked unavailable here
- (instancetype)initWithTitle:(nullable NSString *)title message:(nullable NSString *)message delegate:(nullable id /*<UIAlertViewDelegate>*/)delegate cancelButtonTitle:(nullable NSString *)cancelButtonTitle otherButtonTitles:(nullable NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION NS_EXTENSION_UNAVAILABLE_IOS("Use UIAlertController instead.");
^
In file included from /Users/simpzan/repo/Escalade/PacketTunnel-iOS/main.m:16:
/tmp/injectionforxcode/BundleInjection.h:1082:52: error: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
UIApplication *app = UIApplication.sharedApplication;
^
In module 'UIKit' imported from /tmp/injectionforxcode/IvarAccess.h:61:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:108:54: note: property 'sharedApplication' is declared unavailable here
@property(class, nonatomic, readonly) UIApplication *sharedApplication NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.");
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:108:54: note: 'sharedApplication' has been explicitly marked unavailable here
In file included from /Users/simpzan/repo/Escalade/PacketTunnel-iOS/main.m:16:
/tmp/injectionforxcode/BundleInjection.h:1189:47: error: 'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
^
In module 'UIKit' imported from /tmp/injectionforxcode/IvarAccess.h:61:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:108:54: note: property 'sharedApplication' is declared unavailable here
@property(class, nonatomic, readonly) UIApplication *sharedApplication NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.");
^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:108:54: note: 'sharedApplication' has been explicitly marked unavailable here
4 errors generated.
Thanks for trying. I guess injecting into app extensions just isn’t supported at the moment.
I tried the method on main app, the app can't connect to the server. the first issue is the port, app try to connect to 31442, but server is listening at 31452. the second is that the server is listening on localhost, so it will not accept connection from remote device.
You need to patch from the Injection App as they use different ports. Injection App only listens on localhost as injection does not work on a device any more sue to iOS 10 sandboxing.
What a pity, Injection is much more needed on device, and many iOS features can only work on device.
Could you please detail a little bit what changes in iOS 10 caused Injection app not working on device? Thanks very much!
It used to work but Apple tightened things up with iOS 10. You can not write to the app bundle and you can not load bundles (dylibs) from the user data area which is the only area you can write to.
I am still using iOS 9, so Injection app should work with my device. Is there any guide to get it work? does jailbroken iOS 10 has that restriction? Considering the significant time Injection can save me, I think I got another reason to jailbreak iOS 10.
On Mon, Mar 13, 2017 at 9:38 PM, John Holdsworth notifications@github.com wrote:
It used to work but Apple tightened things up with iOS 10. You can not write to the app bundle and you can not load bundles (dylibs) from the user data area which is the only area you can write to.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johnno1962/injectionforxcode/issues/204#issuecomment-286108896, or mute the thread https://github.com/notifications/unsubscribe-auth/AAWX8uPTtmoM5pBJs0fcRjO9uy7_Gvuuks5rlUbHgaJpZM4MYcqO .
To inject on a device using "patched injection" may still work. I’m not sure if jailbreaking would make any difference and I’m not aware of an iOS10 jailbreak.
Thanks for the reply. :)