小编Esh*_*nya的帖子

解析检索到的Facebook好友详细信息数据

我使用FQL查询一次检索好友列表:

-(void)fetchSaveUserFriendDetails
{
 NSString* query = [NSString stringWithFormat:@"SELECT uid,name,birthday_date FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())"];

 // Set up the query parameter
  NSDictionary *queryParam = [NSDictionary dictionaryWithObjectsAndKeys:
                                    query, @"q", nil];
 // Make the API request that uses FQL
  [FBRequestConnection startWithGraphPath:@"/fql"
                                     parameters:queryParam
                                     HTTPMethod:@"GET"
                              completionHandler:^(FBRequestConnection *connection,
                                                  id result,
                                                  NSError *error) {
    if (!error)
    {
       NSLog(@"result is %@",result);

       NSArray *resultData = [result objectForKey:@"data"];
       if ([resultData count] > 0) {
       for (NSUInteger i=0; i<[resultData count] ; i++) { …
Run Code Online (Sandbox Code Playgroud)

iphone facebook friend fetch details

2
推荐指数
1
解决办法
2738
查看次数

检索在sqlite数据库中插入的所有行,并在包含标签的表视图单元格中显示具有不同部分的子视图

我是objective-c和sqlite的新手.我已经成功地使用sqlite将数据插入到表中.我的项目包含2个页面

添加提醒页面:用户输入数据并单击保存,这是右侧导航栏

查看提醒页面:这是用户在表格视图的单元格中查看已保存的提醒的位置,

即第一单元的第一次提醒,第二单元的第二次提醒等等......

我使用以下代码更轻松地指定了部分的数量,这意味着已保存的提醒的数量等于视图提醒表中的部分数量

-(NSInteger)numberOfSectionsInTableView:(UITableView *)view
{    
    numTableRecords = -1;
    sqlite3_stmt *statement;
    if (sqlite3_open([self.databasePath UTF8String], &remindersDB) == SQLITE_OK) 
    {
        NSString *sqlStatement = [NSString stringWithFormat: @"select count(*) from reminders"];
        const char *sql = [sqlStatement cStringUsingEncoding:NSUTF8StringEncoding];
        if(sqlite3_prepare_v2(remindersDB, sql, -1, &statement, NULL) == SQLITE_OK) 
        {          
            while(sqlite3_step(statement) == SQLITE_ROW) 
            {
                numTableRecords = sqlite3_column_int(statement, 0);
            }
        }
        else 
        {
            printf("could not prepare statement: %s\n", sqlite3_errmsg(remindersDB));
        }
    }

    else 
    {
        NSLog(@"Error in Opening Database File");
    }
    sqlite3_close(remindersDB);
    NSLog(@"Number of records = %d",numTableRecords);
    return numTableRecords; 

} …
Run Code Online (Sandbox Code Playgroud)

sqlite iphone uitableview

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

iphone ×2

details ×1

facebook ×1

fetch ×1

friend ×1

sqlite ×1

uitableview ×1