我正在使用Square Connect API开发iOS应用。我需要连接以下命令:
curl -H "Authorization: Bearer ACCESS_KEY"
https://connect.squareup.com/v1/me/payments
iOS的相当于什么?
答案 0 :(得分:1)
我终于明白了。在此发布此内容供其他人使用以供参考。
NSString *pswd = @"XXXXXXXXX";
NSURL *url = [NSURL URLWithString:@"https://connect.squareup.com/v1/me/payments"];
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
NSString *authValue = [NSString stringWithFormat:@"Bearer %@", pswd];
[request setValue:authValue forHTTPHeaderField:@"Authorization"];