[AC-3950] Cloud.Users.showMe returns empty data with response_json_depth
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Cannot Reproduce |
| Resolution Date | 2016-07-01T15:00:33.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | n/a |
| Labels | n/a |
| Reporter | heedoo moon |
| Assignee | Shak Hossain |
| Created | 2016-06-28T04:39:40.000+0000 |
| Updated | 2018-04-27T08:50:28.000+0000 |
Description
Attachments
| File | Date | Size |
|---|---|---|
| Screen Shot 2016-06-30 at 12.22.00 AM.png | 2016-06-29T18:40:52.000+0000 | 59835 |
| Screen Shot 2016-06-30 at 12.39.23 AM.png | 2016-06-29T18:40:52.000+0000 | 27041 |
Hello, Using the sample code provided on the ticket that you mentioned, I was able to get response successfully. I have tested both in Android and in iOS. See the attachment. Make sure your user is created in the platform and you are using cloud login in your code. This is not a valid bug.
Can you show me how you test code and version? Below code is what I tested and I have that user account. And this is exact error message that I see. {color:#d04437}"Argument callback was an unexpected type! Expexted: function, Received: object"{color} It looks like not taking object parameter. require('ti.cloud').Users.login({ login: 'qqq', password: 'qqqqqqq' }, function (e) { if (e.success) { var user = e.users[0]; console.log("logged in"); require('ti.cloud').Users.showMe({response_json_depth:3}, function(e) { console.log("e: " + JSON.stringify(e)); }); } else { alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e))); } });
Hello, I used the below code.
Make sure you have a user created in the platform. And, use that user email and pass in the above code in the cloud login function.var win = Ti.UI.createWindow({ backgroundColor : '#fff', layout : 'vertical' }); var Cloud = require("ti.cloud"); Cloud.Users.login({ login : 'EMAIL', password : 'PASS' }, function(e) { if (e.success) { var user = e.users[0]; alert('Success:\n' + 'id: ' + user.id + '\n' + 'sessionId: ' + Cloud.sessionId + '\n' + 'first name: ' + user.first_name + '\n' + 'last name: ' + user.last_name); } else { alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e))); } }); // Create a Button. var SHOW_ME = Ti.UI.createButton({ title : 'SHOW_ME', height : Ti.UI.SIZE, width : Ti.UI.SIZE, top : 20, }); // Add to the parent view. win.add(SHOW_ME); function show_me() { Cloud.Users.showMe(function(e) { response_json_depth:2 if (e.success) { var user = e.users[0]; alert('Success:\n' + 'id: ' + user.id + '\n' + 'first name: ' + user.first_name + '\n' + 'last name: ' + user.last_name); } else { alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e))); } }); } // Listen for click events. SHOW_ME.addEventListener('click', function() { show_me(); }); win.open();I don't understand how does your code work. Because your sample "response_json_depth:2" parameter is in callback. For example) Cloud.Users.showMe(function(e) { response_json_depth:2 above code should be ==> Cloud.Users.showMe({response_json_depth:2}, function(e) {
Hello, Try using the code that I sent. This should work for you. Closing the ticket.
Sharif, I already tried not not working for me. Have you tried with my code and same version?
I am trying to call this as follows: Cloud.Users.showMe({ response_json_depth:2 },function (e) { if (e.success) { var user = e.users[0]; alert('Success:\n' + 'id: ' + user.id + '\n' + 'first name: ' + user.first_name + '\n' + 'last name: ' + user.last_name); } else { alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e))); } }); And it gives me below error: Script Error Argument callback was an unexpected type! Expected: function, Received: object