Php 将变量从web视图传递到Xcode并存储为NSString

Php 将变量从web视图传递到Xcode并存储为NSString,php,ios,xcode,webview,nsstring,Php,Ios,Xcode,Webview,Nsstring,我试图从web视图填写的表单中传递一个变量,并将其作为NSString存储在Xcode中。我有一个注册页面,将变量存储为cookie。然后在另一个页面中,我尝试将cookie作为变量返回给Xcode。我想我已经很接近了,但我需要一些帮助 Xcode: NSString *strURL = [NSString stringWithFormat:@"http://www.website.com/get_id.php"]; NSData *dataURL = [NSData dataWithConte

我试图从web视图填写的表单中传递一个变量,并将其作为NSString存储在Xcode中。我有一个注册页面,将变量存储为cookie。然后在另一个页面中,我尝试将cookie作为变量返回给Xcode。我想我已经很接近了,但我需要一些帮助

Xcode:

NSString *strURL = [NSString stringWithFormat:@"http://www.website.com/get_id.php"];
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];

NSString *strResult = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding];

UIAlertView *alert = [[UIAlertView alloc] 
                       initWithTitle:@"Your ID" 
                       message:strResult 
                       delegate:self 
                       cancelButtonTitle:@"Dismiss" 
                       otherButtonTitles:nil, nil];
[alert show];
return;
<?php

$result = action($a, $b);
echo $result;

function action($a, $b){
    $your_email = $_COOKIE["your_email"];
    return $your_email;
}

?>
PHP:

NSString *strURL = [NSString stringWithFormat:@"http://www.website.com/get_id.php"];
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];

NSString *strResult = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding];

UIAlertView *alert = [[UIAlertView alloc] 
                       initWithTitle:@"Your ID" 
                       message:strResult 
                       delegate:self 
                       cancelButtonTitle:@"Dismiss" 
                       otherButtonTitles:nil, nil];
[alert show];
return;
<?php

$result = action($a, $b);
echo $result;

function action($a, $b){
    $your_email = $_COOKIE["your_email"];
    return $your_email;
}

?>


非常感谢您的时间和帮助

你有什么问题?确切地说,什么东西没有像你期望的那样起作用?是否访问php页面?你得到一些数据了吗?数据是否错误?当使用NSString和NSData时,它不想加载cookie,我可以让它传回我正在使用的页面中加载的任何cookie/变量,但它不会提取其他web视图存储的cookie。可能是因为NSData没有打开浏览器?如果我直接在该页面中设置cookie,它就会工作。。。但它不会从其他页面加载cookies。。。这有什么意义吗?