johnno1962 / injectionforxcode

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

not working for real devices #68

Closed zltunes closed 8 years ago

zltunes commented 8 years ago

I can use the plugin in simulator but not working for my devices.

johnno1962 commented 8 years ago

Hi, can you give me more information? Have you patched the project as it says in the README? Has your device connected to the plugin?

vkosmirak commented 8 years ago

Hi @johnno1962 ,

I have a similar problem My steps:

  1. Patch project for Injection
  2. Add Run script Add Run script
  3. Set correct Code Sign Certificate in identity.txt
  4. Run on Device and ⌃=

Result:

...
Uploading '/Users/Volodymyr/Desktop/TestInjection/iOSInjectionProject/build/Debug-iphoneos/InjectionBundle2.bundle' to device...

Loading Bundle...


*** Bundle load failed ***

Consult the Xcode console.

Compiling /Users/Volodymyr/Desktop/TestInjection/TestInjection/AppDelegate.m
        0.51 real         0.04 user         0.30 sys
2016-01-05 17:44:45.289 TestInjection[654:234644] Error loading /var/mobile/Containers/Data/Application/86181A19-F677-4018-82F5-D9506CECE94E/tmp/InjectionBundle2.bundle/InjectionBundle:  dlopen(/var/mobile/Containers/Data/Application/86181A19-F677-4018-82F5-D9506CECE94E/tmp/InjectionBundle2.bundle/InjectionBundle, 265): no suitable image found.  Did find:
    /var/mobile/Containers/Data/Application/86181A19-F677-4018-82F5-D9506CECE94E/tmp/InjectionBundle2.bundle/InjectionBundle: mmap() errno=1 validating first page of '/var/mobile/Containers/Data/Application/86181A19-F677-4018-82F5-D9506CECE94E/tmp/InjectionBundle2.bundle/InjectionBundle'
2016-01-05 17:44:45.290 TestInjection[654:234644] Bundle Load Error
2016-01-05 17:44:45.290 TestInjection[654:234674] *** Bundle has failed to load. If this is due to symbols not found, this may be due to symbols being hidden from dynamic libraries. ***

What did I miss? Thanks

johnno1962 commented 8 years ago

Hi, errno=1 is often a codesigning problem. Is the app and bundle signed with the same profile?

vkosmirak commented 8 years ago

It was "iOS Developer" I set my custom "iPhone Developer: My Name (XX4XXXXX64)" for project and replaced it with last line in identity.txt and it works fine Thanks!