Problem with NSString

Posted by Kassar on Stack Overflow See other posts from Stack Overflow or by Kassar
Published on 2010-06-01T09:10:24Z Indexed on 2010/06/01 9:13 UTC
Read the original article Hit count: 264

Filed under:

I have a problem with NSString in dynamic binding ... I manipulate with Facebook library, when i'll share my story i should make an instance of FBStreamDialog and charge its attributes with values of the story then show it, like this:

    FBStreamDialog* dialog = [[[FBStreamDialog alloc] init]autorelease];
dialog.delegate = self;
dialog.userMessagePrompt = @"prompt";

NSString* sss=@"{ \"name\":\"%@\", \"href\":\"%@\", \"caption\":\"%@\", \"description\":\"%@\" , \"media\":[{ \"type\":\"image\", \"src\":\"%@\", \"href\":\"%@\" }] }";

dialog.attachment = [NSString stringWithFormat:sss,@"title",@"http://www.docs.com/hi.html",@"caption",@"summary",@"http://www.images.com/206.jpg",@"http://www.images.com/206.jpg"];


NSLog(@"ATTACHMENT: %@",dialog.attachment);

The code above is running well. But my problem is when i want to charge these attributes dynamically like this:

BStreamDialog* dialog = [[[FBStreamDialog alloc] init]autorelease];
dialog.delegate = self;
dialog.userMessagePrompt = @"prompt";

NSString* sss=@"{ \"name\":\"%@\", \"href\":\"%@\", \"caption\":\"%@\", \"description\":\"%@\" , \"media\":[{ \"type\":\"image\", \"src\":\"%@\", \"href\":\"%@\" }] }";

dialog.attachment = [NSString stringWithFormat:sss,story.title,story.link,story.caption,story.summary,story.imagelink,story.imagelink];


NSLog(@"ATTACHMENT: %@",dialog.attachment);

It's running without crash but it doesn't share the story it share a blank one !!! Although, it shows in the console (output of NSLog) the value of attachment is true !!!

Could you plz help me.

Sorry for my english.

© Stack Overflow or respective owner

Related posts about objective-c