electra icon indicating copy to clipboard operation
electra copied to clipboard

After JB, run a project ,XCode will prompt the following error.I need your help,thanks.

Open CircularCyanStone opened this issue 6 years ago • 27 comments

Sometimes,the console will output the following error : dyld: could not load inserted library '/usr/lib/TweakInject.dylib' because no suitable image found. Did find: /usr/lib/TweakInject.dylib: code signing blocked mmap() of '/usr/lib/TweakInject.dylib'

  • iOS version: 11.1.2
  • iDevice model:iPhone 6s A1700
  • electra version:1.0.2

CircularCyanStone avatar Mar 01 '18 07:03 CircularCyanStone

The app will run on the second time. Also please search for issues regarding this! This is a dupe :)

nullpixel avatar Mar 03 '18 09:03 nullpixel

I have the same problem.

Every time when I start a test on an iPhone SE (11.1.2) with Electra 1.0.3 I get

dyld: could not load inserted library '/usr/lib/TweakInject.dylib' because no suitable image found.  Did find:
	/usr/lib/TweakInject.dylib: code signing blocked mmap() of '/usr/lib/TweakInject.dylib'

This happens only when JB is active.

stidch avatar Mar 08 '18 08:03 stidch

For me this issue looks like to be related to https://github.com/coolstar/electra/issues/183

stidch avatar Mar 08 '18 10:03 stidch

Same here.

raffi23 avatar Mar 14 '18 05:03 raffi23

Same with me as well. Any fixes yet?

vojtabohm avatar Mar 19 '18 19:03 vojtabohm

Same here on 1.0.4 .. any fixes yet..

malhaar avatar Mar 20 '18 08:03 malhaar

No fix yet? Coolstar help us.

scuty2000 avatar Mar 20 '18 11:03 scuty2000

In my case the App / the test does not start the second time, but fails to start always. A fix would be very appreciated.

@coolstar anybody which could have a look?

stidch avatar Mar 27 '18 07:03 stidch

Same here

douglas-srs avatar Apr 13 '18 12:04 douglas-srs

I have same issue, but I tried reboot and re-jailbreak(now electra 1.0.4 jailbreak button show 'Already Jailbroken'), and run xcode again, it works 😳

tony0x59 avatar Apr 25 '18 03:04 tony0x59

same here.. :'(

MacKaSL avatar Jul 12 '18 05:07 MacKaSL

To people having this issue, you can fix it by: Running the project twice, without changing the code. Second time it won't crash.

Sucks having to run everything twice, but beats having to un-jailbreak and re-jailbreak everytime.

lordzsolt avatar Jul 13 '18 15:07 lordzsolt

it does crash, even second time!

iStorry avatar Jul 16 '18 07:07 iStorry

Same here :( Crashes about four out of five times...

EmanuelMairoll avatar Jul 17 '18 17:07 EmanuelMairoll

Doesn't work :(

Mig-uel avatar Jul 17 '18 20:07 Mig-uel

1.copy /usr/lib/TweakInject.dylib. 2.use your developer certificate sign. 3.copy back.

YasinTian avatar Jul 18 '18 02:07 YasinTian

@YasinTian do the 3 steps fix the problem? can you please explain step 2 a little bit more.

stidch avatar Jul 18 '18 06:07 stidch

@stidch 1.open terminal。input "/usr/bin/security find-identity -v -p codesigning". 2.copy certificate name like this "iPhone Developer: Yunxiang Tian ()". 3.terminal input "codesign -fs "iPhone Developer: Yunxiang Tian ()" TweakInject.dylib". 4.copy the result replace /usr/lib/TweakInject.dylib.

YasinTian avatar Jul 18 '18 08:07 YasinTian

Nice, it works 👍 (at least most of the time)

EmanuelMairoll avatar Jul 18 '18 15:07 EmanuelMairoll

Thanks @YasinTian. At least the mentioned error is gone :) Unfortunately the App resp. the integration tests do still not work. Most probably because of another issue. May I ask you if you have any idea what could be wrong? Looks like you have some experience with jailbreaks.

2018-07-19 11:20:59.573977+0200 DeviceAbstraction_Hardware_IntegrationTest_iOS[987:13423] Injecting /Library/TweakInject/hidspringboard.dylib into com.phonak.mobileapps.DeviceAbstraction-Hardware-IntegrationTest-iOS
2018-07-19 11:20:59.732125+0200 DeviceAbstraction_Hardware_IntegrationTest_iOS[987:13423] refreshPreferences: HangTracerEnabled: 0
2018-07-19 11:20:59.732180+0200 DeviceAbstraction_Hardware_IntegrationTest_iOS[987:13423] refreshPreferences: HangTracerDuration: 500
2018-07-19 11:20:59.732199+0200 DeviceAbstraction_Hardware_IntegrationTest_iOS[987:13423] refreshPreferences: ActivationLoggingEnabled: 0 ActivationLoggingTaskedOffByDA:0
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x000000018187cbc4 libsystem_kernel.dylib`mach_msg_trap + 8
    frame #1: 0x000000018187ca3c libsystem_kernel.dylib`mach_msg + 72
    frame #2: 0x0000000181d2dc74 CoreFoundation`__CFRunLoopServiceMachPort + 196
    frame #3: 0x0000000181d2b840 CoreFoundation`__CFRunLoopRun + 1424
    frame #4: 0x0000000181c4bfb8 CoreFoundation`CFRunLoopRunSpecific + 436
    frame #5: 0x0000000183ae3f84 GraphicsServices`GSEventRunModal + 100
    frame #6: 0x000000018b2202e8 UIKit`UIApplicationMain + 208
    frame #7: 0x0000000100563d34 DeviceAbstraction_Hardware_IntegrationTest_iOS`main at AppDelegate.swift:4
    frame #8: 0x000000018176e56c libdyld.dylib`start + 4
  thread #6
    frame #0: 0x000000018189ddbc libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #1: 0x00000001819aefa0 libsystem_pthread.dylib`_pthread_wqthread + 884
    frame #2: 0x00000001819aec20 libsystem_pthread.dylib`start_wqthread + 4
  thread #7, name = 'com.apple.uikit.eventfetch-thread'
    frame #0: 0x000000018187cbc4 libsystem_kernel.dylib`mach_msg_trap + 8
    frame #1: 0x000000018187ca3c libsystem_kernel.dylib`mach_msg + 72
    frame #2: 0x0000000181d2dc74 CoreFoundation`__CFRunLoopServiceMachPort + 196
    frame #3: 0x0000000181d2b840 CoreFoundation`__CFRunLoopRun + 1424
    frame #4: 0x0000000181c4bfb8 CoreFoundation`CFRunLoopRunSpecific + 436
    frame #5: 0x00000001826756e4 Foundation`-[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
    frame #6: 0x0000000182694afc Foundation`-[NSRunLoop(NSRunLoop) runUntilDate:] + 96
    frame #7: 0x000000018bd7f2f4 UIKit`-[UIEventFetcher threadMain] + 136
    frame #8: 0x0000000182776860 Foundation`__NSThread__start__ + 996
    frame #9: 0x00000001819b031c libsystem_pthread.dylib`_pthread_body + 308
    frame #10: 0x00000001819b01e8 libsystem_pthread.dylib`_pthread_start + 312
    frame #11: 0x00000001819aec28 libsystem_pthread.dylib`thread_start + 4


*** If you believe this error represents a bug, please attach the log file at /var/folders/l1/4cw8chs971j8zzz0vfqrh2v00000gq/T/com.apple.dt.XCTest/IDETestRunSession-46026B5E-0537-4E12-9A6D-4FCA6E495867/Generated.jailbreak_nightly-552D7C1B-FD74-4BE6-928E-7C4E544DE240/Session-Generated.jailbreak_nightly-2018-07-19_112027-SzivWy.log

stidch avatar Jul 19 '18 09:07 stidch

@stidch Sorry,I can't solve this problem.

YasinTian avatar Jul 19 '18 12:07 YasinTian

@YasinTian I was happy to see your comment to solve this issue, but weirdly it doesn't work for me. I've tried with several certificates and I keep getting the error. Is there any additional step required (already tried respring), or something that I've may have missed ?

AnthoPakPak avatar Jul 31 '18 09:07 AnthoPakPak

@AnthoPakPak Look XCode -> Targets -> Signing -> Signing Certificate. Use this certificate.

YasinTian avatar Jul 31 '18 09:07 YasinTian

@YasinTian Oh okay, so the certificate used to sign TweakInject.dylib must be the same as the one used in the app that's it ?

EDIT : still doesn't work even when using the same certificate…

AnthoPakPak avatar Jul 31 '18 09:07 AnthoPakPak

For many jailbreaks happen the same. An easy workaround is to open the app manually before it open automatically after Xcode performs the installation. It allows at least to see the debug gauges, stop in breakpoints and all debug stuff, but executables inputs do not appear in the console (print statements from the app).

EngelTz avatar Aug 08 '18 15:08 EngelTz

Thanks for the tip @EngelTz, it does work ! The only caveat is as you said, that we can't see logs in the console. But you can still debug the app with breakpoints.

AnthoPakPak avatar Aug 10 '18 08:08 AnthoPakPak

I am glad it works for you, @AnthoPakPak 😸!

For those who want or really need to print in console, the debugger could do the stuff of the print. It works fine for me, it feels good to take away a lot of print lines from code and does not need to rebuild the project to do changes of what you print. This page can help to know how to do it: https://coderwall.com/p/ylrgjg/log-messages-with-xcode-breakpoints

Warning: If there are a lot of breakpoints (i.e. loops) the app will feel laggy.

EngelTz avatar Aug 10 '18 17:08 EngelTz