A simple startup process for iOS is described here with short samples for both Objective C and Swift. Before trying the sample, make sure you have imported the frameworks and added the necessary imports.
((void)viewDidLoad{
[super viewDidLoad];
NSURL*url=[NSURL URLWithString:@"/adapters/javaAdapter/users/world"];
WLResourceRequest*request=[WLResourceRequest requestWithURL:url method:WLHttpMethodGet];
[request sendWithCompletionHandler:^(WLResponse*response,NSError*error){
if(error!=nil){
NSLog(@"Failure: %@",error.description);
}
else if(response!=nil){
// Will print "Hello world" in the Xcode Console.
NSLog(@"Success: %@",response.responseText);
}
}
];
}
override func viewDidLoad() {
super.viewDidLoad()
let url = NSURL(string: "/adapters/javaAdapter/users/world")
let request = WLResourceRequest(URL: url, method: WLHttpMethodGet)
request.sendWithCompletionHandler {
(WLResponse response, NSError error) -> Void in
if (error != nil){
NSLog("Failure: " + error.description) }
else if (response != nil){
NSLog("Success: " + response.responseText) }
}
}
(void)viewDidLoad{
[super viewDidLoad];
[[WLAuthorizationManager sharedInstance] obtainAccessTokenForScope: @"" withCompletionHandler:^(AccessToken *accessToken, NSError *error) {
if (error != nil){
NSLog(@"Failure: %@",error.description);
}
else if (accessToken != nil){
NSLog(@"Success: %@",accessToken.value);
}
}];
}
override func viewDidLoad() {
super.viewDidLoad()
WLAuthorizationManager.sharedInstance().obtainAccessTokenForScope(nil) { (token, error) -> Void in
if (error != nil) {
print("Did not recieve an access token from server: " + error.description)
} else {
print("Received access token value: " + token.value)
}
}
}
For more information about logging, see Logger SDK.
For more information about adapters, see Client access to adapters.