Skip to content

Instantly share code, notes, and snippets.

@mpurbo
Created February 17, 2012 11:44
Show Gist options
  • Save mpurbo/1852892 to your computer and use it in GitHub Desktop.
Save mpurbo/1852892 to your computer and use it in GitHub Desktop.
geomon-client-ios: ユーザーの存在の確認(同期のリクエスト)
// MMGClient *client = ...
// ユーザーIDはサーバーで既に登録されるか確認する。
// デリゲートがnilすると、同期してリクエストをする。
MMGObject *checkUserObj = [client checkAvailabilityOfUserId:@"baabaablacksheep" withDelegate:nil];
if (checkUserObj.error != nil || checkUserObj.type != kMMGUser) {
NSLog(@"ユーザー確認のエラーが発生しました: %@", [checkUserObj.error localizedDescription]);
} else {
// タイプはkMMGUserの場合は、安全にMMGUserにキャストできる。
MMGUser *checkUser = (MMGUser *)checkUserObj;
if (checkUser.sid == MMG_UNDEFINED_SID) {
NSLog(@"ユーザーIDはまだ登録されていません。");
} else {
NSLog(@"ユーザーは既に登録済みです、sid = %ld", checkUser.sid);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment