PHP 跨 Objective C iPhone
我这里有一个论坛 http://forum.castoff.net
我正在编写自己的 iPhone 应用程序随它去吧..
我陷入了发布数据、获取数据和登录阶段..
我想我已经弄清楚了将数据发布到php部分...我不知道如何从
PHP中的php页面获取数据我将存储会话和 cookie,以便浏览器知道用户已登录...我将如何在 Objective-C 中执行此操作?
预先感谢
李
I have a forum here http://forum.castoff.net
I am part way through writing my own iPhone App to go with it..
I am stuck on the Posting Data, Getting Data and logging in stage..
I think i have figured out the posting data to php section... I am not sure how to get data from php page
in PHP I would store a session and cookie so that the browser knows a user is logged in... How would i do this in objective-C ?
Thanks in advance
Lee
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您决定使用 UIWebView,这实际上很容易,但从您的描述中我了解到这不是您想要的解决方案。如果你想从页面中检索信息,你可以使用 NSMutableURLRequest,将页面内容转储到 NSString 中并以你想要的方式处理它。看一下这个示例(它涵盖了您发送 POST 数据的加载页面):
如果您决定使用 UIWebView,您所要做的就是:
最简单的解决方案是使用 UIWebView 制作一个应用程序并制作一个移动版本的主题。这样,您真正需要做的就是启动一个应用程序,加载论坛主页,然后让 WebView 处理此后的所有其他事情(授权、维护 cookie 等)。
This is actually quite easy if you decide to go with UIWebView, but from your description I understand that this is not the solution you're going for. If you want to retrieve the information from the page you can use NSMutableURLRequest, get the page content dumped into NSString and process it any way you want there. Take a look at this example (it covers loading page you're sending POST data):
And if you decide to go with UIWebView all you have to do is:
The easiest solution would be to make an App with UIWebView and make a mobile version of the theme. That way all you really have to do is launch an app, load the forum main page and let WebView handle everything else from that point on (authorization, maintaining cookies and such).
使用此库 http://allseeing-i.com/ASIHTTPRequest/
use this library http://allseeing-i.com/ASIHTTPRequest/