Worklight - EncryptedCache open fails with error status 10 - ibm-mobilefirst

I am having some problems with EncryptedCache on my HTC One Android phone.
The same code works on another phone and in the browser simulator but fails on my HTC One android phone with an unusual error code.
I am using: Worklight 6.2
Failing on: HTC one, android 4.4.2 (Cyanogenmod)
Working on: Samsung I9100 Galaxy S II
Working on: browser simulator
WL.EncryptedCache.open fails on my phone and return status 10..
(* WL.EncryptedCache.write fails on my phone and return status 6..)
I have also run the sample app from developerworks as-is on my HTC One phone with the same results and error code.
Sample app link
Logcat log:
Captured from Sample app
1) Destroyed cache
2) Entered a new key
3) Opened cache
4) Got alert error message
Full log can be downloaded from here
My code is:
function wlCommonInit(){
var STORAGE_ID = 'todos';
WL.EncryptedCache.open(STORAGE_ID, true,
function(){ //success
console.log('--> cache opened');
console.log("--> Loading Angular");
angular.element(document).ready(function() {
angular.bootstrap(document, ['todomvc']);
//location.hash = "/";
});
},
function(status){ //fail
console.log("WL.EncryptedCache open error status: " + status);
switch(status){
case WL.EncryptedCache.ERROR_KEY_CREATION_IN_PROGRESS:
alert("ERROR: KEY CREATION IN PROGRESS");
break;
case WL.EncryptedCache.ERROR_LOCAL_STORAGE_NOT_SUPPORTED:
alert("ERROR: LOCAL STORAGE NOT SUPPORTED");
break;
case WL.EncryptedCache.ERROR_NO_EOC:
alert("ERROR: NO EOC");
break;
case WL.EncryptedCache.ERROR_COULD_NOT_GENERATE_KEY:
alert("ERROR: COULD NOT GENERATE KEY");
break;
case WL.EncryptedCache.ERROR_CREDENTIALS_MISMATCH:
alert("ERROR: CREDENTIALS MISMATCH");
break;
default:
alert("AN ERROR HAS OCCURED. STATUS :: " + status);
}
});
}

Sorry to say I cannot currently reproduce this.
Installed Worklight Studio 6.2 from the Eclipse marketplace into a fresh copy of Eclipse and a new workspace
Downloaded the Encrypted Offline Cache sample project > import to Eclipse
Added the Android environment and > Run As > Run on Worklight Development Server
Installed on device (Nexus 5, Android 4.4)
Opened a cache, encrypted some value, closed cache, quit app, re-open, re-open cache, decrypt key, etc etc... all operations seem to pass.
Could you please use Wireshark while you use the app and provide the trace log from there?
In addition, if you could also try the above steps.

I too was getting the same error. My steps were open cache, write, close. Then open again and read.
The issue was close and open again. I kept the cache open for the entire session and it worked fine.
Looks like when you destroy cache, you might have to close it and open again to write a new entry.
Hope it helps.

Related

"BeforeInstallPrompt" is only firing after Lighthouse Audit

I'm writing a small PWA and I'm trying to add an install banner to the page in VueJS/QuasarJS. In the first step, I'm trying to catch if the beforeinstallprompt is firing, with the following code:
mounted() {
console.log("mounting"); // works
window.addEventListener("beforeinstallprompt", (e) => {
console.log(e); // this only fires during Lighthouse Audit
e.preventDefault();
this.deferredPrompt = e;
console.log(`'beforeinstallprompt' event was fired in mounted.`) // only during Lighthouse Audit
})
};
Whenever I load the app, it is not firing at all. But then I tried to run a Lighthouse Audit in Chrome Dev Tools, suddenly it worked! Also, Lighthouse shows that the PWA is installable. But when I do exactly the same thing without Lighthouse, it is not working. So, what is Lighthouse doing that I'm missing...?
Compiling, I've tried two ways but both show same result (only works after I run Lighthouse):
Development build: quasar dev -m pwa --> runs on localhost
Deployed: quasar build -m pwa, firebase deploy --> deployed on firebase
I tried both Firefox and Chrome on Desktop and Android, all with same result. Please if you have an idea, let me know.
Thanks a lot in advance!

OSX App doesn't start(Buid succeeded)

Problem: I am unable to launch my OSX app.
Software versions:
XCode Version 8.1 (8B62)
macOS Siera 10.12.1 (16B2657)
I've already tried:
I don't have any changes in my version control.
Also it works fine on my colleague's computer
I've already tried to clean, Also used deep clean
I've overloaded my mac twice
I've already removed derived data
But still unable to run OSX app. It just build successfully all the time and isn't going to launch my app.
I googled about it.
https://www.google.com/search?q=xcode+%22build+secceded%22&oq=xcode+%22build+secceded%22&aqs=chrome..69i57.12138j0j7&sourceid=chrome&ie=UTF-8#q=xcode+%22build+succeeded%22+%22App+doesn%27t+run%22
But haven't found something helpful.
Any suggestions? Probably I missed something... but I think it is a system bug. And I have to clean or relaunch something. But I've already tried all what I was able to guess.
Information from console:
/Users/UserName/Library/Developer/Xcode/DerivedData/AppName-awtljghmrbqhgebrvruwulpmysqx/Build/Products/Debug/App Name.app/Contents/MacOS/App Name signature not valid: -67030
proc 1042: load code signature error 4 for file "App Name"
AMFI: allowing exception handler for 'App Name' (2504) because the process is unsigned.
Got a connection, waiting for process information for launching or attaching.
error: Attach failed: "No such process".
error: attach failed.
1 +0.000000 sec [09c9/1503]: error: ::read ( 3, 0x700009325a40, 1024 ) => -1 err = Bad file descriptor (0x00000009)
Exiting.
PS
Any way. thanks for attention.

Titanium ACS issue

trying to create an ACS server using Titanium Studio. Following the example of pixgrid (https://github.com/appcelerator/pixgrid/), but always get an error when trying to run locally; console output:
[INFO] Installing dependencies...
[INFO] Dependencies installed.
[INFO] socket.io started
[ERROR] Error occurred. TypeError: Cannot call method 'init' of undefined
at Object.start (/app.js:8:7)
app.js listing:
var ACS = require('acs').ACS,
logger = require('acs').logger,
express = require('express'),
partials = require('express-partials');
// initialize app (setup ACS library and logger)
function start(app) {
ACS.init('***', '***');
logger.setLevel('DEBUG');
//use connect.session
app.use(express.cookieParser());
app.use(express.session({ key: 'node.acs', secret: "secret" }));
//set favicon
app.use(express.favicon(__dirname + '/public/images/favicon.ico'));
//set to use express-partial for view
app.use(partials());
//Request body parsing middleware supporting JSON, urlencoded, and multipart
app.use(express.bodyParser());
}
// release resources
function stop() {
}
Ofcourse I have my OATH key and secret at the ***. Same when running from command line (acs run).
I am running Titanium Studio, build 3.4.1.201410281727.
I can however publish the service, and then run it from the cloud without any issues. For development this is not ideal, so want to run it locally (local node.ACS server).
I guess there must be something wrong with where things are installed (only used default), or permissions. Anyone that got a clue how to fix this? Have spent some hours now searching the internet, but seem to be the only one with this exact problem. No clue what else to try.
Thanks for reading this far. If you require more information to help me, let me know.
Ok, I found the problem. They changed the way to use ACS in the last upgrade.
Classic mode was:
var ACS = require('acs').ACS;
ACS.init('<ACS Key>', '<ACS secret');
Now they changed it and ACS is a "module", like any other one, so you must use the new way. In the package.json file add it as a dependecy:
"dependencies": {
"acs-node": ">=0.9.2"
}
Install it: npm install acs-node
Now you can use it in its new format, on the app.js file:
var ACS = require('acs-node');
ACS.init('<App Key>');
It's all explained here: http://docs.appcelerator.com/cloud/latest/#!/guide/node_acs

how to run multiple test cases in appium with testNG+Java?

i am selenium test automation developer and recently started to develop test cases for mobile automation using appium. i want to run 2 test cases consecutively from my testng.xml but it is running first test case properly but for 2nd one it is unable to start with appium error
"debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Requested a new session but one was in progress)","origValue":"Requested a new session but one was in progress"},"sessionId":"44863100-a0f5-43b9-8c34-cda5636916a5"}"
i think for the 2nd test case new session is not created. so it is possible to kill existing session and start new session in java.
Thanks in advance.
It would be easier for me to provide you an answer if you provide the xml.
However what I will advise you to do is that at the end of your tests use "driver.quit();" so that you don't encounter such an error.
Use session override flag while triggering the appium server, something like:
cd appium; node . --safari --platform-version "platformVersion" -U "deviceID" --session-override
However the reason for existing server might be that your previous server hasn't been closed
If you are using Mac + java, you can use the following code to close appium server:
public void stopServer() {
String[] command = { "/usr/bin/killall", "-KILL", "node" };
try {
Runtime.getRuntime().exec(command);
System.out.println("Appium server stopped.");
} catch (IOException e) {
e.printStackTrace();
}
}

IBM Worklight - AppCenter app missing Plugin 'com.ibm.mobile.InstallerPlugin'

I'm having the same problem as this user. I've built the IBM Worklight AppCenter client application using eclipse (AppCenter -> Run As -> Build All Environments) opened it in xcode (iphone -> Run As -> Xcode project) and run the app in the iphone emulator via xcode.
After I enter my Worklight server credentials in the app (username, password, server, port, context) a "Loading" message is displayed and the app ceases functioning.
I've debugged through the app's javascript and traced the problem to the app trying to execute a call to a Cordova native plugin:
cordova.exec(pSuccessCallback, // Success callback from the plugin
function(e){
console.log("Error connecting to server [code, msg, status] = "
+ e.errorCode + ", "
+ e.errorMsg + ", "
+ e.httpCode);
pFailureCallback(e);
},
'com.ibm.mobile.InstallerPlugin', // Tell cordova to run "com.ibm.mobile.InstallerPlugin" Plugin
'updateConnection', // Tell plugin, which action we want to perform
[pUsername, pPassword, pServerURL]); // Passing list of args to the plugin
This error message is displayed in xcode: IBMAppCenter[2315:70b] ERROR: Method 'updateConnection:' not defined in Plugin 'com.ibm.mobile.InstallerPlugin'
The native libraries implementing this plugin are in their expected locations but don't appear to seen by the application - IBMAppCenter/apps/AppCenter/iphone/native/appCenterLib:
Debug-iphoneos/libAppCenterInstallerLib.a
Release-iphoneos/libAppCenterInstallerLib.a
Debug-iphonesimulator/libAppCenterInstallerLib.a
Release-iphonesimulator/libAppCenterInstallerLib.a
Are there any additional steps required to include the native libraries in the application?
Any help would be greatly appreciated.
The method "updateConnection" is defined in the InstallerPlugin. I think it is simply the first method to be called of the InstallerPlugin, hence the problem might be that you accidentally removed the installer plugin.
The directory IBMAppCenter/apps/AppCenter/iphone/native/appCenterLib must contain the different versions of libAppCenterInstallerLib.a:
Debug-iphoneos/libAppCenterInstallerLib.a
Release-iphoneos/libAppCenterInstallerLib.a
Debug-iphonesimulator/libAppCenterInstallerLib.a
Release-iphonesimulator/libAppCenterInstallerLib.a
The method updateConnection is contained in libAppCenterInstallerLib.a.
If those libs are missing, you can copy them from the original installation directory of IBM Worklight.
Please never delete the native directories of IBMAppCenter/apps/AppCenter before regenerating the iphone or Android environment. If you delete the native directories, you delete those required libraries, and then the AppCenter client is not functional.
I managed to fix this by upgrading to Worklight 6.1.
In recent versions of Cordova, the Plugin method signature has changed.
Verify this by extracting the libAppCenterInstallerlib.a with:
ar -x libAppCenterInstallerlib.a
then run:
nm IBMAppCenterPlugin.o
look for the initInfo or updateConnection methods. If they have :withDict in the method signature, then this is deprecated in recent versions of Cordova.
Using the AppCenter project from Worklight 6.1, I no longer see this issue.