LoLAPI is the most powerful Objective-C RESTful client for the popular online game "League of Legends" by Riot Games. All available web services exposed by the official League of Legends API come fully object mapped, allowing developers to focus on writing their LoL applications without the hassle (or knowledge) of network setup and web service consumption.
To begin using LoLAPI in your project, simply setup your League of Legends API key and desired region by following the example:
#import <LoLAPI/LoLAPI.h>
...
// Initialize the LoLAPI
[LoLAPIManager initWithAPIKey:@"<your_key>" region:LoLRegionIDNorthAmerica];
[LoLAPIManager getChampionsWithFreeToPlayStatusOnly:NO success:^(LoLChampionList *championList) {
for (LoLChampion *champion in championList.champions) {
NSLog(@"champion id is: %ld", (long)[champion.id integerValue]);
}
} failure:^(NSError *error) {
UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Failed to retreive champions. Please try again later." delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[errorAlert show];
}];
LoLAPI requires iOS 5.0 and above or Mac OS X 10.7 and above.
LoLAPI depends on the following third party, open source libraries:
- RestKit - Networking Support, Object Mapping (integrated with Core Data)
The following Cocoa frameworks must be linked into the application target for proper compilation:
- CFNetwork.framework on iOS
- CoreData.framework
- Security.framework
- MobileCoreServices.framework on iOS or CoreServices.framework on OS X
And the following linker flags must be set:
- -ObjC
- -all_load
The LoLAPI codebase is completely written using ARC.
If you are including the LoLAPI sources directly into a project that does not yet use Automatic Reference Counting, you will need to set the -fobjc-arc
compiler flag on all of the LoLAPI source files. To do this in Xcode, go to your active target and select the "Build Phases" tab. Now select all LoLAPI source files, press Enter, insert -fobjc-arc
and then "Done" to enable ARC for LoLAPI.
The recommended approach for installing LoLAPI is via the CocoaPods package manager, as it provides flexible dependency management and dead simple installation. For best results, it is recommended that you install via CocoaPods >= 0.19.1 using Git >= 1.8.0 installed via Homebrew.
Install CocoaPods if not already available:
$ [sudo] gem install cocoapods
$ pod setup
Change to the directory of your Xcode project, and Create and Edit your Podfile and add LoLAPI:
$ cd /path/to/MyProject
$ touch Podfile
$ edit Podfile
platform :ios, '5.0'
# Or platform :osx, '10.7'
pod 'LoLAPI', '~> 0.1.0'
Install into your project:
$ pod install
Open your project in Xcode from the .xcworkspace file (not the usual project file)
$ open MyProject.xcworkspace
Please note that if your installation fails, it may be because you are installing with a version of Git lower than CocoaPods is expecting. Please ensure that you are running Git >= 1.8.0 by executing git --version
. You can get a full picture of the installation details by executing pod install --verbose
.
If you have successful instructions on how to install using this method, please share with me so that I can begin a wiki for others to see.
LoLAPI is licensed under the terms of the Apache License, version 2.0. Please see the LICENSE file for full details.
LoLAPI is brought to you by Troy Stump. Special thanks to Blake Watters and the RestKit team for their amazing framework (and also for the formatting of this README).