我正在使用 Square Connect API 开发一个 iOS 应用程序。我需要使用以下命令进行连接:
curl -H "Authorization: Bearer ACCESS_KEY"
https://connect.squareup.com/v1/me/payments
这在 iOS 中是什么?
最佳答案
我终于明白了。在此发布以供其他人引用。
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"];
关于ios - curl 命令、-H 选项和 Square API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25902856/