H
H
hypzin2017-10-17 09:09:47
Objective-C
hypzin, 2017-10-17 09:09:47

How to get instance-id in yandex sdk?

I would like to implement payment in Objective C, but I ran into the fact that I can not get the instance-id. I read the documentation, tried to implement it in this code, the message “illegal_param_instance_id” comes in response, maybe an error in the post? or do you need to get the instance-id in some other way and who faced this problem?

NSMutableURLRequest *urlRequest = ;
    
    NSString *userUpdate = @"client_id";
    
    //create the Method "GET" or "POST"
    [urlRequest setHTTPMethod:@"POST"];
 
    //Convert the String to Data
    NSData *data1 = [userUpdate dataUsingEncoding:NSUTF8StringEncoding];
    
    //Apply the data to the body
    
    [urlRequest setHTTPBody:data1];
    
    NSURLSession *session = [NSURLSession sharedSession];
    NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
        if(httpResponse.statusCode == 200)
        {
            NSError *parseError = nil;
            NSDictionary *responseDictionary = [NSJSONSerialization JSONObjectWithData:data options:0 error:&parseError];
            printf("DIctionary", responseDictionary);
            NSLog(@"The response is - %@",responseDictionary);
            NSInteger success = [[responseDictionary objectForKey:@"success"] integerValue];
            if(success == 1)
            {
                NSLog(@"Login SUCCESS");
            }
            else
            {
                NSLog(@"Login FAILURE");
            }
        }
        else
        {
            NSLog(@"Error");     
        }
    }];
    [dataTask resume];

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question