trigger.io iOS Facebook apprequests incorrect parameter quotation - ios

I'm making an apprequests using native Facebook plugin as follows:
forge.facebook.ui(
{
method: "apprequests",
title: "How well do you know your friends?",
message: "Play this friends guessing game with me. This is just like the game Guess Who with Facebook.",
to: 100005076427220
},
function(response) {
alert('succ:' + JSON.stringify(response));
}, function(response){
alert('error:' + JSON.stringify(response));
}
);
On Android everything looks fine. Here is the debug output:
[ INFO] D/Forge (11035): Native call facebook.ui with task.params: {"method":"apprequests","title":"How well do you know your friends?","message":"Play this friends guessing game with me. This is just like the game Guess Who with Facebook.","to":100005076427220}
[ INFO] D/Forge (11035): Returned: {"content":{"to[0]":"100005076427220","request":"1404036919832397"},"callid":"39281D3C-EACE-4070-937C-3BE1852DA12F","status":"success"}
Unfortunately on iOS is not. Here is the debug output:
[DEBUG] Native call: {
[DEBUG] callid = "BF08EEC1-175D-483F-846B-319721A82B04";
[DEBUG] method = "facebook.ui";
[DEBUG] params = {
[DEBUG] message = "Play this friends guessing game with me. This is just like the game Guess Who with Facebook.";
[DEBUG] method = apprequests;
[DEBUG] title = "How well do you know your friends?";
[DEBUG] to = 100005076427220;
[DEBUG] };
[DEBUG] }
[DEBUG] 2013-10-30 15:53:53.283 Forge[732:907] -[__NSCFNumber UTF8String]: unrecognized selector sent to instance 0x1cdd9c20
[DEBUG] Returning to javascript: {
[DEBUG] callid = "BF08EEC1-175D-483F-846B-319721A82B04";
[DEBUG] content = {
[DEBUG] message = "-[__NSCFNumber UTF8String]: unrecognized selector sent to instance 0x1cdd9c20";
[DEBUG] type = "UNEXPECTED_FAILURE";
[DEBUG] };
[DEBUG] status = error;
As you can see, the parameter method = apprequests; is not quoted as it is in Android
method = "apprequests"; It is not from my code but from the public plugin itself.
Is it possible that this makes the error?
I'm using Platform version v2.0.3 and Facebook module v2.0.1

Related

imap error after received Gimap ready for requests

I have an error when i run the code.
the following is the code:
void smtp_listener::imapLogin(QString reply)
{
print_D(FUNC);
print_D(QString("this is "+reply+"well"));
if(reply.contains("OK"))
{
QString msg = QString("user %1").arg(user);
print_D(msg);
*t << msg <<"\r\r\n";
t->flush();
setState(POP3_Pass);
}
else
{
print_E("ERROR :"+reply,FUNC,__LINE__);
quitConn();
setState(POP3_Quit);
}
}
void smtp_listener::pop3Pass(QString reply)
{
print_D(FUNC);
print_D(QString("this is "+reply+" well"));
if(reply.contains("+OK"))
{
QString msg = QString("pass %1").arg(pass);
*t << msg <<"\r\n";
t->flush();
setState(POP3_Stat);
}
else
{
print_E("ERROR :"+reply,FUNC,__LINE__);
quitConn();
setState(POP3_Quit);
}
}
the error i give after i debug:
[Debug] "Email account : connected."
[Debug] "void smtp_listener::imapLogin(QString)"
[Debug] "this is * OK Gimap ready for requests from 140.101.159.251
q2-v6mb85227685wrd
well"
[Debug] "user chairouyih#gmail.com"
[Debug] "void smtp_listener::pop3Pass(QString)"
[Debug] "this is user BAD Unknown command q2-v6mb85227685wrd
well"
"[Error] ERROR :user BAD Unknown command q2-v6mb85227685wrd
at func=void smtp_listener::pop3Pass(QString) Line=361"
[Debug] "void smtp_listener::quitConn()"
[Debug] "void smtp_listener::pop3Quit(QString)"
[Debug] "* BAD invalid tag q2-v6mb85227685wrd
You are using POP3 commands with an IMAP server. They are not compatible, and their language is very different.
For one, every IMAP command has a tag, and basic logging in is done with a LOGIN command. It would look something like this:
a001 LOGIN user#gmail.com "password"
If you want to use POP3, connect to the pop3 server at pop.gmail.com, with TLS enabled on port 995.

MobileFirst ChallengerHandler not returning from submitLoginForm call when using ISAM authentication

(UPDATE added at end)
I have a native iOS MobileFirst (7.0) client written in Swift. The MobileFirst Server is behind a firewall and accessed though a junction on IBM Security Access Manager for Web (ISAM). ISAM is being used for adapter authentication. I've already tested the app without ISAM in the middle (no authentication), and it works fine.
A custom challenge handler is registered:
let myCH = MyChallengeHandler(vc: self)
WLClient.sharedInstance().registerChallengeHandler(myCH)
MyChallengeHandler sets the realm in its init() function:
init(vc: LoginViewController){
self.vc = vc
super.init(realm: "HeaderAuthRealm")
}
The app first connects to the server using wlConnectWithDelegate:
WLClient.sharedInstance().wlConnectWithDelegate(ConnectListener(vc: self))
And once the connection is made, it should call a adapter method on the server to look up the user info (using invokeProcedure):
let invocationData = WLProcedureInvocationData(adapterName: "login", procedureName: "lookUpRole")
invocationData.parameters = [userid]
WLClient.sharedInstance().invokeProcedure(invocationData, withDelegate: LoginListener(vc: self))
However it's not getting that far.
When ISAM is involved, it is protecting everything, include the connect URL, so the challenge handler is first getting called when the wlConnectWithDelegate() is attempted because ISAM returns a login page.
The challenge handler is properly detecting the login page and the handleChallenge() function is being called. Userid/password is collected from the user if necessary, and then it calls a function that calls submitLoginForm(). The custom onConnect() and onFailure() functions are defined in the challenge handler as well:
override func handleChallenge(response: WLResponse!)
{
handleChallengeISAM(response)
}
func handleChallengeISAM(response: WLResponse!)
{
//HPDIA0200W Authentication failed. You have used an invalid user name, password or client certificate.
let failedLogin = response.responseText.rangeOfString("HPDIA0200W") != nil
if vc.security.authDataSet && !failedLogin
{
println("=========== Sending login data directly")
submitISAMAuthData()
}
else
{
println("=========== A login screen form should appear")
if failedLogin {
needCredentials("Please check your credentials.")
} else {
needCredentials(nil)
}
}
}
func submitISAMAuthData()
{
let loginPostUrl = "https://wstest.clearlake.ibm.com/pkmslogin.form"
let params = ["username" : vc.security.userid , "password" : vc.security.password, "login-form-type" : "pwd"]
println("=========== Sending submitLoginForm request")
self.submitLoginForm( loginPostUrl, requestParameters: params, requestHeaders: nil, requestTimeoutInMilliSeconds: -1, requestMethod: nil)
println("=========== submitLoginForm request Sent")
}
override func onSuccess(response: WLResponse!)
{
println("=========== onSuccess")
let isLoginResponse = isCustomResponse(response)
if isLoginResponse {
println("=========== RE-challenged")
handleChallenge(response)
} else {
println("=========== Challenge success")
submitSuccess(response)
}
}
override func onFailure(response: WLFailResponse!)
{
println("=========== Challenge failure")
println("\(response.errorMsg)")
submitFailure(response)
}
The problem is that is as far as it gets. The request never gets to the ISAM device, and the onSuccess() or onFailure() functions are never called. The iOS simulator log states that the request was made, but that's it. No indication that it actually did anything.
=========== Sending submitLoginForm request
2015-04-09 15:00:12.866 ThirdPartyCompliance[54200:2903010] [DEBUG] [WL_AFHTTPCLIENTWRAPPER_PACKAGE] +[WLAFHTTPClientWrapper requestWithURL:] in WLAFHTTPClientWrapper.m:46 :: Request url is https://wstest.clearlake.ibm.com/pkmslogin.form
2015-04-09 15:00:12.871 ThirdPartyCompliance[54200:2903010] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:141 :: Request timeout is 10.000000
2015-04-09 15:00:12.876 ThirdPartyCompliance[54200:2903010] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:220 :: Sending request (https://wstest.clearlake.ibm.com/pkmslogin.form) with headers:
{
"Accept-Language" = en;
"User-Agent" = "ThirdPartyCompliance/1 (iPad Simulator; iOS 8.2; Scale/2.00)/WLNativeAPI/7.0.0.0";
"X-Requested-With" = XMLHttpRequest;
"x-wl-app-version" = "1.0";
"x-wl-device-id" = "C1CFD648-C648-439C-AC9F-8292FDAC20E6";
"x-wl-platform-version" = "7.0.0.0";
}
You can see the request body in the Analytics platform logs.
=========== submitLoginForm request Sent
The ISAM logs don't show the submitLoginForm request ever being sent despite what the iOS MobileFirst API logs say. Is something wrong with submitLoginForm() in v7.0?
UPDATE:
It seems that WLClient.sharedInstance().wlConnectWithDelegate() has to succeed before ChallengeHandler.submitLoginForm() will work. I verified this by using a proxy server in front of the ISAM device to send adapter service requests through ISAM, and all other MobileFirst server connections bypass ISAM. In this architecture, the submitLoginForm() function works fine, since wlConnectWithDelegate() is succeeding without login.
This is a little confusing since the ChallengeHandler is called when using wlConnectWithDelegate(), but some of the ChallengeHandler's methods don't yet work until after wlConnectWithDelegate() finishes. Also I can't find it documented anywhere that it works this way.
When ISAM is protecting all the resources between the Mobile app and MFP server, the initial call by wlConnectWithDelegate() will fail, as the call will not go up to the MFP Server. The initial connection URL/s have to be left unprotected (unauth in ISAM).
This link http://www-01.ibm.com/support/docview.wss?uid=swg24034222 contains the integration solution between ISAM and worklight/Mobile First 7.x. In v3.6 integration solution, there is a guide for Form Based Login integration (isam_impf_loginform_int_guide.pdf). The URLs given below are the ones that need to be left unprotected, without which the initial connection/certificate based connection/DirectUpdate will be unsuccessful.
/WebSEAL/<webseal-host-name>-<instance-name>/<context-root>/apps/services/api/<application_name>/<platform>/init
/WebSEAL/<webseal-host-name>-<instance-name>/<context-root>/apps/services/api/<application_name>/<platform>/authenticate
/WebSEAL/<webseal-host-name>-<instance-name>/<context-root>/directUpdate/<application_name>/<platform>
/WebSEAL/<webseal-host-name>-<instance-name>/<context-root>/authorization/v1/clients/instance
I hope this helps.

How to connect to development server in the cloud

I can't connect to my MobileFirst server from my iOS native app.
I change the host, wlServerContext and port in my worklight.plist.
I upload the .wlapp and .adapter in the console of the server.
This is the log in my app:
2015-03-30 14:34:31.119 El_Universal_Demo[696:146217] Connecting to server and initializing push notification ...
2015-03-30 14:34:31.125 El_Universal_Demo[696:146217] [DEBUG] [WL_CONFIG] -[WLConfig init] in WLConfig.m:69 :: {
"application id" = "El_Universal_Demo";
"application version" = "1.0";
environment = iOSnative;
host = "198.11.212.197";
platformVersion = "7.0.0.0";
port = 8080;
protocol = http;
wlServerContext = "/wladmin";
wlUid = "wY/mbnwKTDDYQUvuQCdSgg==";
}
2015-03-30 14:34:31.160 El_Universal_Demo[696:146217] [WARN] [USER_CERT_AUTH] + [WLUserAuthManager getCertificateIdentifier] in WLUserAuthManager.m:68 :: Certificate Identifier Key: com.worklight.userenrollment.certificate:com.eluniversal.El-Universal-Demo
2015-03-30 14:34:31.173 El_Universal_Demo[696:146217] [DEBUG] [WL_AFHTTPCLIENTWRAPPER_PACKAGE] +[WLAFHTTPClientWrapper requestWithURL:] in WLAFHTTPClientWrapper.m:46 :: Request url is http://198.11.212.197:8080/wladmin/apps/services/api/El_Universal_Demo/iOSnative/init
2015-03-30 14:34:31.202 El_Universal_Demo[696:146217] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:141 :: Request timeout is 60.000000
2015-03-30 14:34:31.206 El_Universal_Demo[696:146217] [DEBUG] [WL_REQUEST] -[WLRequest sendRequest:path:withOptions:] in WLRequest.m:220 :: Sending request (http://198.11.212.197:8080/wladmin/apps/services/api/El_Universal_Demo/iOSnative/init) with headers:
{
"Accept-Language" = es;
"User-Agent" = "El_Universal_Demo/1 (iPhone; iOS 8.1.2; Scale/2.00)/WLNativeAPI/7.0.0.0";
"X-Requested-With" = XMLHttpRequest;
"x-wl-app-version" = "1.0";
"x-wl-clientlog-appname" = "El_Universal_Demo";
"x-wl-clientlog-appversion" = "1.0";
"x-wl-clientlog-deviceId" = "A6042553-8580-4365-A69C-6731388D6A56";
"x-wl-clientlog-env" = iOSnative;
"x-wl-clientlog-model" = "iPhone6,1";
"x-wl-clientlog-osversion" = "8.1.2";
"x-wl-device-id" = "A6042553-8580-4365-A69C-6731388D6A56";
"x-wl-platform-version" = "7.0.0.0";
}
You can see the request body in the Analytics platform logs.
2015-03-30 14:34:31.219 El_Universal_Demo[696:146217] [DEBUG] [WL_AFHTTPCLIENTWRAPPER_PACKAGE] -[WLAFHTTPClientWrapper start] in WLAFHTTPClientWrapper.m:297 :: Starting the request with URL http://198.11.212.197:8080/wladmin/apps/services/api/El_Universal_Demo/iOSnative/i nit
2015-03-30 14:34:31.225 El_Universal_Demo[696:146217] [DEBUG] [WL_REQUEST] __42-[WLRequest sendRequest:path:withOptions:]_block_invoke in WLRequest.m:230 :: waiting for response... (Thread=<NSThread: 0x17007f3c0>{number = 1, name = main})
2015-03-30 14:34:31.231 El_Universal_Demo[696:146217] url a cargar (null)
2015-03-30 14:34:31.288 El_Universal_Demo[696:146217] APNS Token : <9f662f33 5de5971b 5371851e 7d91fc17 f6f83d55 a9c913f6 973eec67 2e10c365>
2015-03-30 14:34:31.289 El_Universal_Demo[696:146217] APNS Token : <9f662f33 5de5971b 5371851e 7d91fc17 f6f83d55 a9c913f6 973eec67 2e10c365>
2015-03-30 14:34:31.476 El_Universal_Demo[696:146217] [DEBUG] [WL_AFHTTPCLIENTWRAPPER_PACKAGE] -[WLAFHTTPClientWrapper requestFailed:error:] in WLAFHTTPClientWrapper.m:324 :: Request Failed
2015-03-30 14:34:31.480 El_Universal_Demo[696:146217] [DEBUG] [WL_AFHTTPCLIENTWRAPPER_PACKAGE] -[WLAFHTTPClientWrapper requestFailed:error:] in WLAFHTTPClientWrapper.m:325 :: Response Status Code : 404
2015-03-30 14:34:31.484 El_Universal_Demo[696:146217] [DEBUG] [WL_AFHTTPCLIENTWRAPPER_PACKAGE] -[WLAFHTTPClientWrapper requestFailed:error:] in WLAFHTTPClientWrapper.m:326 :: Response Error : Expected status code in (200-299), got 404
2015-03-30 14:34:31.501 El_Universal_Demo[696:146217] [ERROR] [WL_REQUEST] -[WLRequest requestFailed:error:] in WLRequest.m:466 :: Status code='404' error='Expected status code in (200-299), got 404' response=''
2015-03-30 14:34:31.508 El_Universal_Demo[696:146217] [DEBUG] [WL_REQUEST] -[WLRequest requestFailed:error:] in WLRequest.m:469 :: Response Header: {
Connection = "Keep-Alive";
"Content-Language" = "en-US";
"Content-Length" = 0;
Date = "Mon, 30 Mar 2015 20:34:44 GMT";
"Keep-Alive" = "timeout=10, max=100";
"X-Powered-By" = "Servlet/3.0";
}
Response Data:
2015-03-30 14:34:31.514 El_Universal_Demo[696:146217] [ERROR] [WL_CLIENT] - [WLClient onInitRequestFailure:userInfo:] in WLClient.m:1060 :: onInitRequestFailure
I need to test an example with notifications based on tags. My example works locally but I want to test it with the development server in the cloud and I cannot do that if my app doesn't connect.
I'm using MobileFirst 7.0
Regards.
You say it's working locally. Can you expend on that?
Are you sure in the settings you've placed in worklight.plist?
http://198.11.212.197:8080/wladmin/apps/services/api/El_Universal_Demo/iOSnative/init
That IP address looks local to me rather than remote ("in the cloud"). Verify your settings.
Thanks, this problem was resolved.
I had to reinstall all the configuration of installation in my server and again upload the run time (.war), wlapp and adapter.
Also in the moment when I did the deploy of my native app in eclipse some times appeared an error in the console about a problem in the file .war.
So I had to make other workspace and verify settings of my native app. (worklight.plist)
My problem now is that I donĀ“t receive any notification in my iPhone when I run a notification of my adapter but is other topic.
[1] How to invoke the url or link of an adapter
Regards

Trigger.io App crashing when using forge.event.connectionStateChange.addListener

I'm trying to use forge.event.connectionStateChange.addListener from the docs. I've create and entirely empty application, added "event":true to the config.json configuration and added the following bit to the main.js:
forge.logging.info("Add JavaScript to js/main.js!");
forge.event.connectionStateChange.addListener(
function() {
alert('Device ' + (forge.is.connection.connect() ? "is" : "is not") + 'connected.');
},
function(){
alert('Erorr');
}
);
When I run the application and turn off my machine's wifi, the application crashes. I can provide more log if needed.
[DEBUG] Native call: {
[DEBUG] callid = "9B3DBB44-870E-438B-8128-07E88474DDAB";
[DEBUG] method = "launchimage.hide";
[DEBUG] params = {
[DEBUG] };
[DEBUG] }
[DEBUG] Returning to javascript: {
[DEBUG] callid = "9B3DBB44-870E-438B-8128-07E88474DDAB";
[DEBUG] content = "<null>";
[DEBUG] status = success;
[DEBUG] }
[INFO] No reload update available.
[INFO] 2013-03-04 16:59:54.725 Forge[68603:c07] +[BorderControl returnResult:]: unrecognized selector sent to class 0x2fb4a4
[INFO] 2013-03-04 16:59:54.725 Forge[68603:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[BorderControl returnResult:]: unrecognized selector sent to class 0x2fb4a4'
[INFO] *** First throw call stack:
[INFO] (0x33b6012 0x2e55e7e 0x34412ad 0x33a5bbc 0x33a594e 0x2e695c8 0x2895765 0x3339f3f 0x333996f 0x335c734 0x335bf44 0x335be1b 0x33107e3 0x3310668 0x1d99ffc 0x26e6 0x2625)
[INFO] libc++abi.dylib: terminate called throwing an exception
Sorry - our bad: this is a symptom of the same problem which was causing problems with Reload in v1.4.32.
There's a fix in v1.4.33 - please do give it a try and let me know if that works for you.

Trigger.io sencha doesn't load on iOS

I am stuck on a blank white screen while loading Trigger.io iOS with Sencha 2.
It works fine on Android, but on iOS, it just shows a blank white screen.
Here's the debug output:
[INFO] 943E7E1BD31/Library/Application%20Support/Forge/assets-AA20D894-4614-43FB-BE67-D78F05175E9B/src/index.html
[DEBUG] Returning to javascript: {
[DEBUG] event = \"internal.connectionStateChange\";
[DEBUG] params = {
[DEBUG] connected = 1;
[DEBUG] wifi = 1;
[DEBUG] };
[DEBUG] }
[DEBUG] Native call: {
[DEBUG] callid = \"C812FD5E-EFAE-4BCD-A3EE-CFB2574F70EA\";
[DEBUG] method = \"internal.hideLaunchImage\";
[DEBUG] params = {
[DEBUG] };
[DEBUG] }
[DEBUG] Returning to
[DEBUG] script: {
[DEBUG] callid = \"C812FD5E-EFAE-4BCD-A3EE-CFB2574F70EA\";
[DEBUG] content = \"<null>\";
[DEBUG] status = success;
[DEBUG] }
After hiding launch image, it's calling content = \"<null>\"; ?
It turns out Sencha 2 has a bug, it was throwing an error like this:
Error: [ERROR][Ext.viewport.Ios#undefined] Timeout waiting for window.innerHeight to change
I did some research, and it seems to be a bug relating to Safari vs. UI Web View.
To solve this problem, add this under Ext.application({
viewport: { autoMaximize: false },
Cheers

Resources