iphone - Objective-C:在 iPhone 上访问 REST API 的最佳方式

标签 iphone objective-c web-services rest

我们已经为此苦苦挣扎了一段时间。我正在尝试访问 iPhone 上的 REST api,并遇到了可以帮助我的 ASIHTTP 框架。所以我做了类似的事情

//call sites, so we can confirm username and password and site/sites
NSURL *url = [NSURL URLWithString: urlbase];
ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
[request setUsername:@"doronkatz%40xx.com" ];
[request setPassword:@"xxx"];

其中 urlbase 是 REST 站点的 URL。

现在,开发人员告诉我这个框架可能存在问题或错误,并且它没有正确传递 header 。是否有其他方法可以通过身份验证来测试或访问网络 REST 位置?

最佳答案

我建议查看 RestKit:http://restkit.org/它提供了一个出色的 API,用于访问 RESTful Web 服务并将远程资源表示为本地对象,包括将它们持久保存到 Core Data。开箱即用地支持 HTTP 身份验证。

关于iphone - Objective-C:在 iPhone 上访问 REST API 的最佳方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2264092/

相关文章:

.net - 异常 "System.Net.WebException: The remote name could not be resolved"的原因?

iphone - UISwitch 的颜色

iphone - 点击包含 uiimageview 的 uiscrollview 打开模态视图

ios - 约束在 UITableViewCell 中无法正常工作。如何正确设置?

java - 如何为 HTTP GET 的多个键值参数设计 REST URI

java - AIX 上的 "SunX509 TrustManagerFactory not available"(SSL 网络服务客户端)

ios - 设备方向未获取。

ios - 在#import "myFile.h"中丢失完成

ios - Base 64 编码 Objective-C

objective-c - iAds : Why doesn't CCGLView *eaglView = [[CCDirector sharedDirector] openGLView] work?