From 6167330ee1d2bee3c1dcee1bb975b4b1f6225357 Mon Sep 17 00:00:00 2001 From: richard-stowe Date: Fri, 21 Nov 2014 13:47:07 +0000 Subject: [PATCH] Fixed issue with using the Screenshot service on a Mac. Prior to this fix setting screenshots from devices would result in the following exception: Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'imobiledevice-sdk': dlopen(libimobiledevice-sdk.dylib, 9): image not found at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:169) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:242) at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:205) at org.libimobiledevice.ios.driver.binding.raw.ImobiledeviceSdkLibrary.(ImobiledeviceSdkLibrary.java:25) at org.libimobiledevice.ios.driver.binding.services.IOSDevice.(IOSDevice.java:44) at org.libimobiledevice.ios.driver.binding.services.DeviceService.get(DeviceService.java:37) at IosDriverTest.runTest(IosDriverTest.java:66) at IosDriverTest.main(IosDriverTest.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) --- .../ios/driver/binding/raw/ImobiledeviceSdkLibrary.java | 3 ++- .../org/libimobiledevice/ios/driver/binding/raw/JNAInit.java | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/libimobiledevice/ios/driver/binding/raw/ImobiledeviceSdkLibrary.java b/src/main/java/org/libimobiledevice/ios/driver/binding/raw/ImobiledeviceSdkLibrary.java index 5e87d9b..1d89a82 100644 --- a/src/main/java/org/libimobiledevice/ios/driver/binding/raw/ImobiledeviceSdkLibrary.java +++ b/src/main/java/org/libimobiledevice/ios/driver/binding/raw/ImobiledeviceSdkLibrary.java @@ -21,7 +21,8 @@ * For help, please visit NativeLibs4Java , Rococoa, or JNA. */ public class ImobiledeviceSdkLibrary implements Library { - public static final String JNA_LIBRARY_NAME = "imobiledevice-sdk"; + private static final boolean initialized = JNAInit.init(); + public static final String JNA_LIBRARY_NAME = "imobiledevice-sdk"; public static final NativeLibrary JNA_NATIVE_LIB = NativeLibrary.getInstance(ImobiledeviceSdkLibrary.JNA_LIBRARY_NAME); static { Native.register(ImobiledeviceSdkLibrary.class, ImobiledeviceSdkLibrary.JNA_NATIVE_LIB); diff --git a/src/main/java/org/libimobiledevice/ios/driver/binding/raw/JNAInit.java b/src/main/java/org/libimobiledevice/ios/driver/binding/raw/JNAInit.java index 47f8426..2b61688 100644 --- a/src/main/java/org/libimobiledevice/ios/driver/binding/raw/JNAInit.java +++ b/src/main/java/org/libimobiledevice/ios/driver/binding/raw/JNAInit.java @@ -79,7 +79,6 @@ public static synchronized boolean init() { copy("darwin/idevicedebug", dst); dst.setExecutable(true); - ImobiledeviceSdkLibrary.sdk_idevice_event_unsubscribe(); initialize = true; return true; }