Iphone – Publish UIWebview via Facebook connect


I am using fbConnect in my Cocoa Touch application. I have UIWebview on my view, and I want to publish the UIWebview's context (its only text) to FaceBook.

How should I change the FBStream to publish my UIWebview?

FBStreamDialog* dialog2 = [[[FBStreamDialog alloc] init] autorelease];
            dialog2.delegate = self;
            dialog2.userMessagePrompt = @"Share Ghazals on your wall";
            dialog2.attachment = @"{\"name\":\"Hafez Application for iPhone\","
            "\"properties\":{\"another link\":{\"text\":\"Hafez App HomePage\",\"href\":\"http://www.momeks.com/hafez\"}}}";
            // replace this with a friend's UID
            // dialog.targetId = @"999999";
            [dialog2 show];

Here is my UIWebView Code:

NSString *path = [[NSBundle mainBundle] pathForResource:@"webViewContent" ofType:@"html"];
     NSFileHandle *readHandle = [NSFileHandle fileHandleForReadingAtPath:path];

     NSString *htmlString = [[NSString alloc] initWithData: 
                             [readHandle readDataToEndOfFile] encoding:NSUTF8StringEncoding];

     webView.opaque = NO;
     webView.backgroundColor = [UIColor clearColor];
     [self.webView loadHTMLString:htmlString baseURL:nil];
     [htmlString release];

Best Solution

Not sure I understand what you mean by sharing UIWebview context.

If you want to publish text, then there are numerous examples for that on FBConnect.

You might want to try ShareKit, as it makes everything very easy....

If you could please re-explain the question, I could offer better help.

Godspeed, Oded.