Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7604533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:56:03+00:00 2026-05-30T23:56:03+00:00

hopefully someone can help me with this odd problem. I have a database which

  • 0

hopefully someone can help me with this odd problem.

I have a database which stores the Facebook ID of all users who have registered, and this works just fine.

Users can send messages to their Facebook friends through PHP script which is activated via the app.

In my script I have a section which says that if the ID of one of your friends is NOT in the database (i.e. they are not a registered user), then post a message to their Facebook wall notifying them that someone has tried to contact them using the app.

There is then a second database which stores the ID of people we have notified via FB, so that we do not send them multiple requests.

The problem is that the message doesn’t ever appear on their wall. The message is sent to the PHP script as a string like this:

    NSString *urlString = [@"myApp/myphp.php?"stringByAppendingString:@"task=send"];
    urlString = [urlString stringByAppendingString:@"&facebookID="];
    urlString = [urlString stringByAppendingString:[friendsToSendTo objectAtIndex:i]];
    urlString = [urlString stringByAppendingString:@"&message="];
    urlString = [urlString stringByAppendingString:message];
    urlString = [urlString stringByAppendingString:@"&sound="];
    urlString = [urlString stringByAppendingString:chosenSoundToSend];
    urlString = [urlString stringByAppendingString:@"&sendersName="];
    urlString = [urlString stringByAppendingString:myName];

In the PHP script, the task=send part then starts the process of sending a message to the recipient. This part works absolutely fine, the message is received with no problems at all.

If their ID is not found it then moves on to this:

    $this->_postToFacebook($sendersName, $facebookID);

The _postToFacebook function looks like this:

    private function _postToFacebook($sender, $receiver)
    {
    require_once "facebook.php";

    //registered with developers.facebook for this particular app
    $app_id = "****************";
    $app_secret = "*****************";

    $facebook = new Facebook(array(
    'appId' => $app_id,
    'secret' => $app_secret,
    'cookie' => true
    ));

    // Get the url to redirect for login to facebook
    // and request permission to write on the user's wall.
    $login_url = $facebook->getLoginUrl(
        array('scope' => 'publish_stream')
    );

    // If not authenticated, redirect to the facebook login dialog.
    // The $login_url will take care of redirecting back to us
    // after successful login.
    if (! $facebook->getUser()) {
        echo <<< EOT
    <script type="text/javascript">
    top.location.href = "$login_url";
    </script>;
    EOT;

        exit;
    }
    // Do the wall post.
    $facebook->api("/$receiver/feed", "post", array(
        message => "$sender sent you a message",
        picture => "image.jpg",
        link => "mywebsite.com",
        name => "Visit iTunes to download and reply",
        caption => "mycaption"
    ));

}

This is seemingly the part that fails, or at least that was my initial assumption.
However, if I manually enter the generated URL (….task=send&facebookID=12345789…etc) into a browser and hit enter – the message DOES get posted to the users wall.

So now I am completely confused.
When triggering via the browser, the message is received in the app if the Facebook ID is registered and is posted to FB if not.
From the app itself, the message is received when the recipient is registered – but the posting to FB never works.
Presumably I have missed some kind of permission somewhere?

Thanks in advance to anyone who can help 🙂

Edit: In case it is a permissions thing, I should add that I have set these permissions:

 if (![facebook isSessionValid]){

    NSArray *permissions = [[NSArray alloc] initWithObjects:
                            @"user_relationships", @"friends_relationships",
                            @"user_relationship_details", @"friends_relationship_details",
                            @"read_friendlists",@"offline_access", @"publish_stream",
                            nil];
    [facebook authorize:permissions];
    [permissions release];
}

And in the facebook class I had to change these to NO otherwise it doesn’t connect at all, maybe this also causes the problem?

- (void)authorize:(NSArray *)permissions {
  self.permissions = permissions;

   [self authorizeWithFBAppAuth:NO safariAuth:NO];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:56:04+00:00Added an answer on May 30, 2026 at 11:56 pm

    You may need to encode your URL string. If fields (like name, message, etc.) have spaces or other special characters, the URL request/connection from iOS will fail. Web browsers usually do this encoding for you automatically but iOS doesn’t.

    Once you have your URL string, try:

    urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
    

    As a side note, you might want to use [NSString stringWithFormat:@"", ...] rather than multiple stringByAppendingString calls. Something like:

    urlString = [NSString stringWithFormat:
                 @"myApp/myphp.php?facebookID=%@&message=%@&sound=%@",
                 [friendsToSendTo objectAtIndex:i]], message, sound];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hopefully someone can help me with a slight problem/confusion I have with Viewpagers and
Hopefully someone can help me with this problem. I'm starting to work with Drupal
hopefully someone can help me with this headache I have. I'm currently running Drupal
This issue is something which has me stumped, so hopefully someone can help. I
Apologies if this is too abstract, but hopefully someone can help. I have a
I have searched endlessly to no avail on this, hopefully someone can help! I
Hopefully someone can help me debug this problem as EXC_BAD_ACCESS is the only error
Hopefully someone here can help me with this challenge! I have a parent page
Ok, this is bit of an obscure question, but hopefully someone can help me
I have a weird date rounding problem that hopefully someone can solve. My client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.