johnno1962 / injectionforxcode

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

Can't Working On a Device #137

Closed AmySong closed 8 years ago

AmySong commented 8 years ago

My Objective - c project 1: main.m file:


import <UIKit/UIKit.h>

import "AppDelegate.h"

int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }

// From here to end of file added by Injection Plugin //

ifdef DEBUG

static char _inMainFilePath[] = FILE; static const char *_inIPAddresses[] = {"192.168.5.58", "192.168.2.1", "169.254.206.76", "127.0.0.1", 0};

define INJECTION_ENABLED

import "/tmp/injectionforxcode/BundleInjection.h"

endif


2: after control+= , there is bad ,


* Could not codesign as '': /Users/songdan/Desktop/luxclub_ios/iOSInjectionProject/build/Debug-iphoneos/InjectionBundle2.bundle _

 at /Users/songdan/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/common.pm line 57.
 main::error('Could not codesign as : /Users/songdan/Desktop/luxclubio...') called at /Users/songdan/Library/Application Support/Developer/Shared/Xcode/Plug-ins/InjectionPlugin.xcplugin/Contents/Resources/injectSource.pl line 513
** Bundle build failed ***



3:I find two ways from internet, one way: i remove iOSInjectionProject from project, 'Build Phases' add 'Run Script', the last build ,but invalid.

AmySong commented 8 years ago

2016-05-19 10 52 31

johnno1962 commented 8 years ago

It’s not picking up a codesigning identity for your project:

my $infoFile = "$archDir/identity.txt";

if ( !-f $infoFile ) {
    my %VARS = `$xcodebuild -showBuildSettings $config` =~ /    (\w+) = (.*)\n/g;
    IO::File->new( "> $infoFile" )->print( "$VARS{CODESIGNING_FOLDER_PATH}\n$VARS{CODE_SIGN_IDENTITY}\n");
}
AmySong commented 8 years ago

2016-05-20 10 45 06 identity.txt does't exist.

johnno1962 commented 8 years ago

Do you have your build locations preference set to the non-default? Try commenting out this line in injectSource.pl (Menu: Product/Injection Plugin/Open Resource/Code Injection Script)

138: unlink $infoFile if $buildRoot && !-d $localBundle;