Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Friends.Search not working for other users besides logged in user

$
0
0

Hi, I want to show a list of friends for any user on their profile page. I did it using friends.search call to the cloud and showing the results in table. On the profile of user logged in, it works and everything is good but when i navigate to my friends profile it gives an error with "You are not authorized to perform this action" alert.

here is my code. thanks in advance.

ps whosprofile is the variable for id of user who's profile page we are opening

Cloud.Friends.search({
            user_id: whosprofile,
        },  function (e) {
            if (e.success) {                
                for (var i = 0; i < e.users.length; i++) {
                var user = e.users[i];
                    var friendusername= user.username;
 
                        var row = Ti.UI.createTableViewRow();
                var background = Ti.UI.createView({
                    backgroundColor:'#f7f7f7',
                    width: '100%', height: 60, top:5
                });   
                var username = Ti.UI.createLabel ({
                    width: 200,
                    left: 60,
                    text: friendusername,
                    top: 12,
                    color: '#305053'
                });         
                background.add(username);                         
                row.add(background);
                tableDatafriend.push(row);
                }
                    tablefriend.setData(tableDatafriend);
                resultstwo.add(tablefriend);
            } else {
                alert('Error:\n' +
                    ((e.error && e.message) || JSON.stringify(e)));
            }
        });

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>