johnno1962 / injectionforxcode

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

Undefined symbols for architecture x86_64: "_INColors", referenced from: -[ViewController changeColor] in ViewController.o #194

Closed lifubo closed 7 years ago

lifubo commented 7 years ago

Hi, I have a problem about Tunable Parameters, can you help me ! thank you ! I want to use Tunable Parameters in my demo, and Xcode hint "Undefined symbols for architecture x86_64:"_INColors", referenced from: -[ViewController changeColor] in ViewController.o ld: symbol(s) not found for architecture x86_64"

My Xcode version is 8.2.

This is my code

import "ViewController.h"

ifdef DEBUG

define INJECTION_ENABLED

import "/tmp/injectionforxcode/BundleInterface.h"

endif

@interface ViewController ()

@end

@implementation ViewController

johnno1962 commented 7 years ago

You’ll need to “patch" your project to get tunable parameters to work.

lifubo commented 7 years ago

That is work! thank you very much! I have another problem, Injection can not work in my iPhone, I can run my app in iphone,but when I press "control + =", Injection does not work and there is nothing in injection console and Xcode console .You “patch" my project.

johnno1962 commented 7 years ago

Injection no longer works on a device due to sandboxing in iOS 10

lifubo commented 7 years ago

My iphone is ios 8

johnno1962 commented 7 years ago

Is injection connecting? Is this a network issue. Check your main.m for the IP address.

lifubo commented 7 years ago

Yesterday,my iphone was out of internet,now the internet is OK ,but xcode console hints “injection connection refused”. Another question :do you have any plans about supporting ios 10?

The wrong message: Injection: Could not connect: Operation timed out Injection attempting connection to: 127.0.0.1:31442 Injection: Could not connect: Connection refused Injection attempting connection to: 172.18.27.17:31442 Injection: Could not connect: Operation timed out Injection attempting connection to: 127.0.0.1:31442 Injection: Could not connect: Connection refused Injection attempting connection to: 172.18.27.17:31442 Injection: Could not connect: Operation timed out Injection attempting connection to: 127.0.0.1:31442 Injection: Could not connect: Connection refused Giving up on connecting to Injection, restart app.

johnno1962 commented 7 years ago

Sorry my bad there, To inject on the device you have to use the plugin version of injection which involves “unsigning” Xcode.

lifubo commented 7 years ago

where can I download the plugin version of injection which you mentioned? Another question :Do you have any plans about supporting ios 10?

johnno1962 commented 7 years ago

It is not possible to support iOS10 on a device due to changes made by Apple to to the sandboxing. For the plugin I can only refer you to github https://github.com/johnno1962/injectionforxcode though I’m trying to avoid supporting people through this difficult process by producing the app.

lifubo commented 7 years ago

Is it impossible to support iOS10 on simulator either?You said "To inject on the device you have to use the plugin version of injection which involves “unsigning” Xcode." I want to know where I can download the plugin version of injection.

johnno1962 commented 7 years ago

Injection.app works with iOS 10 in the simulator and is the injection for you. The injection plugin is a difficult install the details of which are on the page https://github.com/johnno1962/injectionforxcode

lifubo commented 7 years ago

I will use injection.app . Now , I use the injection plugin in my project, not injection.app. Injection plugin does not work in my device, xcode outputs wrong messages. My xocde viersion is 8.2 and my device system is 8.2. The wrong messages: Injection: Could not connect: Operation timed out Injection attempting connection to: 127.0.0.1:31442 Injection: Could not connect: Connection refused Injection attempting connection to: 172.18.27.17:31442 Injection: Could not connect: Operation timed out Injection attempting connection to: 127.0.0.1:31442 Injection: Could not connect: Connection refused Injection attempting connection to: 172.18.27.17:31442 Injection: Could not connect: Operation timed out Injection attempting connection to: 127.0.0.1:31442 Injection: Could not connect: Connection refused Giving up on connecting to Injection, restart app.

johnno1962 commented 7 years ago

Is there a Product/Injection Plugin menu item in Xcode now? Could this be a firewall problem?

lifubo commented 7 years ago

Yes, there is ,Injection plugin works in my simulator 9.3 ,but it does not work in my iphone! Does iPhone 5 have firewall?

johnno1962 commented 7 years ago

Your Mac has a firewall. Did Xcode ask for permission to accept incoming connections?

Is the port open: $ netstat -an | grep 31442 tcp4 0 0 .31442 .* LISTEN

lifubo commented 7 years ago

The port is open. $ netstat -an | grep 31442 tcp4 0 0 .31442 .* LISTEN

I do not know if Xcode asks for permission to accept incoming connections, but if Xcode asks for some permissions, I always click "YES".