SSXboxLeaders是一个基于块的Objective-C类,用于简化在IOS和OS X项目中对xboxleaders.com API的使用。
包含一个演示应用程序,以展示库的基本功能。它的基本功能非常有限,没有最小检测或GUI更新,但它是有效的。
获取游戏标签的用户资料
NSString *gamerTag = @"theholyboot";
[SSXboxLeaders fetchGamerProfile:gamerTag success:^(GamerProfile *profile) {
NSLog(@"Profile details: %@", [profile description]);
} failure:^(NSError *error) {
NSLog(@"Error: %@", error);
}];
获取游戏玩家所玩游戏的列表,并将其用作UITableView的数据源
NSString *gamerTag = @"theholyboot";
[SSXboxLeaders fetchGamesPlayed:gamerTag success:^(NSArray *gamesPlayed) {
self.gamesList = gamesPlayed;
[self.gamesTableView reloadData];
} failure:^(NSError *error) {
NSLog(@"Error: %@", error);
}];
列出游戏玩家对特定游戏的成就
NSString *gamerTag = @"theholyboot";
NSNumber *gameId = @"1161890200"; // ID for Fifa13
[SSXboxLeaders fetchArchievements:gamerTag forTitleId:gameId success:^(NSArray *achievements) {
// Show achievements array in TextView
self.achievementTextView.text = [achievements description];
} failure:^(NSError *error) {
NSLog(@"Error: %@", error);
}];
列出游戏玩家的所有好友,并注意在线和离线的数量
NSString *gamerTag = @"theholyboot";
[SSXboxLeaders fetchFriendsInfo:gamerTag success:^(FriendsInfo *friendsInfo) {
self.friendsList = friendsInfo.Friends;
self.totalFriendsLabel.text = [NSString stringWithFormat:@"Total Friends: %@",[friendsInfo.TotalFriends stringValue]];
self.totalFriendsOnlineLabel.text = [NSString stringWithFormat:@"Total Online Friends: %@",[friendsInfo.TotalOnlineFriends stringValue]];
self.totalFriendsOfflineLabel.text = [NSString stringWithFormat:@"Total Offline Friends: %@",[friendsInfo.TotalOfflineFriends stringValue]];
[self.friendsTableView reloadData];
} failure:^(NSError *error) {
NSLog(@"Error: %@", error);
}];
这个库仍在积极开发中。评论或问题请在@sandalsoft处提出。