views:

34

answers:

0

I'm trying to pre-populate the publish stream in the Facebook Connect code so that when the user wants to share on FB its already got the dynamic info.

here the date code that calculates time intervals on viewdidload

NSString *dateStr = @"20100716";
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyyMMdd"];
NSDate *startDate = [dateFormat dateFromString:dateStr]; 
NSDate *endDate = [NSDate date];

NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];

NSUInteger unitFlags = NSWeekCalendarUnit | NSDayCalendarUnit; 

NSDateComponents *components = [gregorian components:unitFlags
fromDate:startDate
toDate:endDate options:0];

/*just making sure calcs are firing*/
NSLog(@"NSDate *startDate = %@", startDate);
NSLog(@"NSDate *endDate = %@", endDate);
NSLog(@"%d", [components week]);
NSLog(@"%d", [components day]);


/* change text labels with NSString with components above*/
compweek.text = [NSString stringWithFormat:@"%d weeks",[components  week]];
compday.text = [NSString stringWithFormat:@"%d days",[components  day]];

//release the set variables
[dateStr release];
[dateFormat release];
[gregorian release];}

So I have the string to post the calcs i'm looking for put I can't figure out how to get them into this attachment section with the NSDictionary

 NSDictionary* actionLinks = [NSArrayarrayWithObjects:[NSDictionarydictionaryWithObjectsAndKeys: 
                      @"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil];

NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                           @"App Name", @"name",
                         @"prepopulate text here", @"caption",
                           @"foo fun fun", @"description",
                           @"http://linkage", @"href", nil];

So that code block populates the area under the user text field in the FB publish pop up window. Thats where I'd like to pre-populate with the dynamic date code.

Thanks