• Problem With FBDialog Cancel Button

    The FBConnects’s FBDialog class has a problem with the cancel button. When user taps the cancel button, the delegate method “dismissWithSuccess” is called instead of “dialogDidCancel“. This flaw in the FBConnect SDK makes it difficult to determine whether the user has tapped on cancel button or not.

    We can overcome this issue by editing FBDialog.m in the FBConnect. Add the below code as the first line in FBDialog.m’s webViewDidFinishLoad : methods

    [_webView stringByEvaluatingJavaScriptFromString:@"document.getElementById('cancel').onclick = function onclick(event) { window.location.href = 'fbconnect:cancel'; }"];

    This should fix the issue and dialogDidCancel should get called correctly..!

     
  • Uploading Images To Facebook Wall Using FBConnect

    We can upload images to Facebook users wall using the following FBConnect code:


    FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];
    dialog.delegate = self;
    dialog.userMessagePrompt = "Image Upload Sample";
    dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"Anish\","
    "\"href\":\"http://www.macoscoders.com/\",\"description\":\"This is an example to upload image to FB\","
    "\"media\":[{\"type\":\"image\","
    "\"src\":\"http://www.macoscoders.com/images/anish.jpg\","
    "\"href\":\"http://www.macoscoders.com/\"}],"
    "\"properties\":{\"another link\":{\"text\":\"Home page\",\"href\":\"http://www.macoscoders.com/\"}}}"]];
    [dialog show];

    Make sure you have implemented the correct delegate methods for FBConnect to know the status of posting to wall
    Cheers..!

     

Bad Behavior has blocked 308 access attempts in the last 7 days.

array(0) { }