オーナーであるグループの一覧取得

ユーザーは、自分がオーナーであるグループの一覧を取得できます。

オーナーであるグループの一覧を取得するサンプルコードを以下に示します。

Swift:

  • // Get the currently logged-in user.
    let user = KiiUser.current()
    
    do{
      // Get a list of groups owned by the current user.
      let ownerGroups = try user!.ownerOfGroupsSynchronous() as! [KiiGroup]
    
      for group in ownerGroups{
        // Do something.
      }
    }catch(let error as NSError){
      // Handle the error.
      return
    }
  • // Get the currently logged-in user.
    let user = KiiUser.current()
    
    // Get a list of groups owned by the current user.
    user!.ownerOfGroups({ (user :KiiUser?, results : [Any]?, error : Error?) -> Void in
      if error != nil {
        // Handle the error.
        return
      }
    
      for group in results as! [KiiGroup] {
        // Do something.
      }
    })

Objective-C:

  • // Get the currently logged-in user.
    KiiUser* user = [KiiUser currentUser];
    
    NSError* error = nil;
    
    // Get a list of groups owned by the current user.
    NSArray* ownerGroups = [user ownerOfGroupsSynchronous:&error];
    if (error != nil) {
      // Handle the error.
      return;
    }
    
    for (KiiGroup* group in ownerGroups) {
      // Do something.
    }
  • // Get the currently logged-in user.
    KiiUser* user = [KiiUser currentUser];
    
    // Get a list of groups owned by the current user.
    [user ownerOfGroupsWithBlock:^(KiiUser *user, NSArray *results, NSError *error) {
      if (error != nil) {
        // Handle the error.
        return;
      }
    
      for (KiiGroup* group in results) {
        // Do something.
      }
    }];