私はこの行でSIGNAL11を取得しています:
// Call bool isInternetConnection()
jboolean jReturnValue = env->CallBooleanMethod(mClass,mid);
このコードでは:
/**
* Check if Internet Connection is ONLINE
*/
bool InterfaceJNI::isInternetConnected()
{
JavaVM* jvm = JniHelper::getJavaVM();
int status;
JNIEnv *env;
jmethodID mid;
bool isAttached = false;
bool returnValue = false;
CCLog("InterfaceJNI isInternetConnected");
// Get Status
status = jvm->GetEnv((void **) &env, JNI_VERSION_1_6);
if(status < 0)
{
CCLog("isInternetConnected Status < 0 Failed to get JNI Enviroment!!!");
status = jvm->AttachCurrentThread(&env, NULL);
CCLog("isInternetConnected Status 2: %d", status);
if(status < 0)
{
CCLog("isInternetConnected Status < 0 !!!");
return false;
}
isAttached = true;
CCLog("isInternetConnected Status isAttached: %d", isAttached);
}
CCLog("isInternetConnected Status: %d", status);
CCLog("isInternetConnected Finding Class....");
jclass mClass = env->FindClass("org/example/SocialNetwork/CCSocialNetwork");
// Get Static bool isInternetConnection()
CCLog("isInternetConnected Getting method....");
mid = env->GetMethodID(mClass, "isInternetConnection", "()Z");
if (mid == 0)
{
CCLog("isInternetConnected FAIL GET METHOD STATIC");
return false;
}
CCLog("isInternetConnected Calling method....");
// Call bool isInternetConnection()
jboolean jReturnValue = env->CallBooleanMethod(mClass,mid);
CCLog("Call done ");
// Convert value from Java to C++
returnValue = (bool)jReturnValue;
CCLog("isInternetConnected Done ");
if(isAttached)
jvm->DetachCurrentThread();
// Change for return value
return returnValue;
}
でも理由はわかりません。「()V」を使用してvoid呼び出しを行うと正常に機能しますが、ブール値を返す関数を呼び出そうとすると、no。
何が起こっている?