传说 0.4.0

传说 0.4.0

测试已测试
Lang语言 Obj-CObjective C
许可 MIT
发布最新发布2014 年 12 月

Jean-Philippe Couture 维护。



传说 0.4.0

  • 作者:
  • Jean-Philippe Couture

League of Legends 的 iOS 和 OS X 聊天服务库。

安装

将以下内容添加到您的 Podfile 中,然后运行 pod install

pod 'Folklore'

不要忘记 #import <Folklore/Folklore.h>

使用

建立连接

- (void)didTapConnectButton:(id)sender {
    _folklore = [[Folklore alloc] initWithServerRegion:LoLServerRegionNorthAmerica];
    [_folklore setDelegate:self];
    [_folklore connectWithUsername:@"jdoe"
                          password:@"secret123"];
}

#pragma mark - FolkloreDelegate Protocol

- (void)folkloreDidConnect:(Folklore *)folklore {
    NSLog(@"Connection successful");
}

- (void)folkloreConnection:(Folklore *)folklore didFailWithError:(NSError *)error {
    NSLog(@"Connection failed with error: %@", error);
}

朋友列表填充

#pragma mark - FolkloreDelegate Protocol

- (void)folklore:(Folklore *)folklore didPopulateBuddyList:(NSArray *)buddyList {
    for (FolkloreBuddy *buddy in buddyList) {
        NSLog(@"%@ is %@", buddy.name, (buddy.isOnline ? @"online" : @"offline"));
    }
}

发送和接收消息

// `_buddies` is a NSArray of FolkloreBuddy objects, obtained during a buddy list update.
[_folklore sendMessage:@"Welcome to Summoner's Rift!" toBuddy:_buddyList[index]];

#pragma mark - FolkloreDelegate Protocol

- (void)folklore:(Folklore *)folklore didReceiveMessage:(NSString *)message fromBuddy:(FolkloreBuddy *)buddy {
    NSLog(@"[%@] %@", buddy.name, message);
}

联系方式

许可

传说遵从 MIT 许可协议。有关更多信息,请参阅 LICENSE 文件。

免责声明

《英雄联盟》的内容和材料是 Riot Games 或其许可人的商标和版权。版权所有。