Once you've integrated the AerisWeather SDK for iOS into your project, you'll need to setup your project to start using the SDK.
The AerisWeather SDK for iOS is written in Objective-C, but since it's pre-compiled as dynamic frameworks, it's easy to use in either Swift or Objective-C projects. Use either the Swift or Objective-C methods below to get started.
Import AerisWeatherKit in the application delegate:
import AerisWeatherKit
Setup the SDK with your application's API keys in the application:didFinishLaunchingWithOptions:
application delegate method:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
AerisWeather.start(withApiKey: "__CLIENT_ID__", secret: "__CLIENT_SECRET__")
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.backgroundColor = UIColor.whiteColor()
window?.makeKeyAndVisible()
return true
}
In the Swift files you wish to use any of the Aeris Weather SDK libraries, import the appropriate modules:
import AerisWeatherKit
import AerisMapKit
import AerisMapboxMapKit
import AerisGoogleMapKit
You're now ready to start loading data in your application! Review our data loading or weather map guides for more information and examples. You can also reference the complete set of developer docs for each SDK for more information about classes, methods and properties.
Import AerisWeatherKit in the application delegate:
@import AerisWeatherKit;
or without modules enabled:
#import <AerisWeatherKit/AerisWeatherKit.h>
Setup the SDK with your application's API keys in the application:didFinishLaunchingWithOptions:
application delegate method:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[AerisWeather startWithApiKey:@"__CLIENT_ID__" secret:@"__CLIENT_SECRET__"];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
In the Objective-C files you wish to use any of the AerisWeather SDK libraries, import the appropriate frameworks:
@import AerisWeatherKit
@import AerisMapKit
@import AerisMapboxMapKit
@import AerisGoogleMapKit
or without modules enabled:
#import <AerisWeatherKit/AerisWeatherKit.h>
#import <AerisMapKit/AerisMapKit.h>
#import <AerisMapboxMapKit/AerisMapboxMapKit.h>
#import <AerisGoogleMapKit/AerisGoogleMapKit.h>
You're now ready to start loading data in your application! Review our data loading or weather map guides for more information and examples. You can also reference the complete set of developer docs for each SDK for more information about classes, methods and properties.
By default, the logging level of the AerisWeather SDK for iOS is set to output for the warning and error levels only. However, during development you may need to view more detailed output when using the SDK, such as requests being made or other informational details.
You can toggle debug mode on or off depending on how much logging output you need. By default debug mode is disabled. However, you can enable it in your application delegate:
[[AerisWeather sharedInstance] setDebugMode:YES];
AerisWeather.sharedInstance().debugMode = true
To disable debug mode, just pass NO
or false
to the above method, or remove the call to setDebugMode:
and the SDK will fall back to the default of debug mode being disabled.
Last modified: July 30, 2020