标签: asihttprequest

如何使用objective-c在Amazon S3上创建文件夹

我知道这是一个之前可能会被问过的问题(至少在Python中),但我仍然在努力做到这一点.我将本地文件夹结构和内容与我在Amazon S3存储桶中存储的内容进行比较.在S3上存在但在本地找不到的目录将在我的S3存储桶中创建.似乎Amazon S3没有文件夹概念,而是将文件夹标识为大小为0的空文件.我的问题是,如何通过放置一个空文件轻松地在objective-c中创建一个文件夹(在S3上命名对应于文件夹名称)(我使用ASIHTTP来获取和放置事件)?我想通过将新文件复制到非现有文件夹来显式创建目录而不是隐式创建目录.感谢您对此的帮助.

cocoa objective-c amazon-s3 asihttprequest

1
推荐指数
1
解决办法
2474
查看次数

将对象从PHP发送到iOS的最简单方法

我在iPhone上使用ASIHTPTRequest从Web服务器中获取一些对象.我正在做以下事情:

  1. 使用ASIHTTPRequest从iPhone发出请求.
  2. 运行PHP的Web服务器生成我的对象的XML表示.
  3. iPhone读取它,解析XML并生成我的自定义对象.

这可行,但似乎是一些应该更简单的事情(我认为).

有没有办法让这个过程更有效率?

在某些时候我也需要做相反的事情(在iPhone上生成XML并将其发送到运行PHP的Web服务器)但还没有到达那里......我不是特别喜欢XML并且会很乐意如果有任何可以更好地适应这种情况的更改格式.

任何帮助是极大的赞赏!

xml asihttprequest ios

1
推荐指数
1
解决办法
336
查看次数

如何停止正在运行的ASIHTTPNetworkQueue?

我想知道如何阻止正在运行的ASIHTTPNetworkQueue?
它有可能吗?因为当我解除设置网络队列的视图时,我的应用程序崩溃了.

iphone xcode asihttprequest

1
推荐指数
1
解决办法
68
查看次数

ASIHTTPRequest和背景

Wat在我们开始请求时发生,我们在请求完成之前进入后台?我们必须取消它吗?这样做的正确方法是什么?

PS:当用户输入背景时,我不希望我的下载继续.

谢谢,

iphone background asihttprequest ios

1
推荐指数
1
解决办法
1491
查看次数

设置委托时ASIHTTPRequest崩溃了吗?

这可能是一个简单的问题,但我现在已经盯着这一段时间,我找不到它!

我有一个SOAPRequest类,如下所示:

@interface SoapRequest : NSObject

@property (retain, nonatomic) NSURL *endPoint;
@property (retain, nonatomic) NSString *soapAction;
@property (retain, nonatomic) NSString *userName;
@property (retain, nonatomic) NSString *passWord;
@property (retain, nonatomic) NSString *postData;
@property (retain, nonatomic) NSObject *handler;
@property SEL action;

+ (SoapRequest*) create: (NSObject*) target endPoint: (NSString*) endPoint action: (SEL) action soapAction: (NSString*) soapAction postData: (NSString*) postData;

- (id)sendSynchronous;
- (void) send;

@end
Run Code Online (Sandbox Code Playgroud)

实施如下:

@synthesize endPoint = _endPoint, soapAction = _soapAction, userName = _userName, passWord = _passWord, postData = _postData, action …
Run Code Online (Sandbox Code Playgroud)

iphone xcode objective-c asihttprequest ios

1
推荐指数
1
解决办法
1065
查看次数

仪器(XCode4)报告ASIHttpRequest泄漏内存?

我在XCode 4中获得了来自ASIHttpRequest的报告内存泄漏的工具......我无法弄清楚问题,转而我们注释掉了我的所有代码来处理结果并使得函数如下所示,但xcode仍然报告相同的内存泄漏......

每次单击按钮时都会调用此方法,每次按下按钮时都会发生更多内存泄漏.:(

- (void) loadData
{
    // no data set, we need to load ourself
    NSURL *url = [self getDataUrl];
    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];

    ////////////////////////////////////////////////////////////////////
    // set cache policy
    //

    // always store data in cache
    [request setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy];
    // Always ask the server if there is new content available, 
    // If the request fails, use data from the cache even if it should have expired.
    [request setCachePolicy:ASIAskServerIfModifiedWhenStaleCachePolicy|ASIFallbackToCacheIfLoadFailsCachePolicy];


    [request setCompletionBlock:^{
        NSLog(@"[http request] finishing %@", url);

        [self dataDidLoadSuccess];
    }];

    [request …
Run Code Online (Sandbox Code Playgroud)

iphone memory-leaks objective-c asihttprequest xcode4

1
推荐指数
1
解决办法
2001
查看次数

轮询网络以确定网络是否可达?

我试图实现ASIHTTPRequest从服务器下载文件.我有一个选项是用户可以将下载添加到队列并ASINetworkQueue逐个处理文件下载.

我正在尝试实现一个功能,其中,如果用户丢失了他们的网络连接,我ASINetworkQueue应该连续轮询网络可达性.一旦连接再次可用,应用程序就会从停止的位置开始下载文件.

我不是要求代码,但如果有人可以帮我提供一系列提示,我将不胜感激.


为了使我的应用程序从中断的位置下载文件,我正在使用该ASIHTTPRequest方法

[request setAllowResumeForFileDownloads:YES];
Run Code Online (Sandbox Code Playgroud)

user-experience objective-c asihttprequest reachability ios

1
推荐指数
1
解决办法
504
查看次数

ASIHTTPRequest向请求添加标头

我正在使用ASIHTTPRequest,我必须使用POST方法将一些值发送到服务器.所以,为此我必须设置标题及其相应的值.

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request addRequestHeader:@"Referer" value:@"http://allseeing-i.com/"];
Run Code Online (Sandbox Code Playgroud)

以下是需要被包含在我的应用程序标题,我怎么可能包括一次用分号("Content-Type" = "text/html";,"Keep-Alive" = "timeout=15, max=100";等等)

    "Content-Type" = "text/html";

    Date = "Wed, 21 Jun 2011 09:09:57 GMT";

    "Keep-Alive" = "timeout=15, max=100";

    Server = Apache;

    "Transfer-Encoding" = Identity;
Run Code Online (Sandbox Code Playgroud)

iphone objective-c asihttprequest

1
推荐指数
1
解决办法
3197
查看次数

asihttprequest图片下载

大家好,大家好.我正在使用asihttprequest进行一系列图像下载 - 来自服务器的4张图像.但是我注意到了一些问题并且无法找到解决方案.假设我正在通过URL下载4个图像,并且如果任何一个或两个图像不可用,它将取消整个队列.

这是我的代码:

    [networkQueue setDownloadProgressDelegate:progressIndicator];
    [networkQueue setRequestDidFinishSelector:@selector(imageFetchComplete:)];
    [networkQueue setRequestDidFailSelector:@selector(imageFetchFailed:)];

    request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://imagees/image1.jpg"]];
    [request setDownloadDestinationPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"1.png"]];
    [request setDownloadProgressDelegate:imageProgressIndicator1];
    [request setUserInfo:[NSDictionary dictionaryWithObject:@"request1" forKey:@"name"]];
    [networkQueue addOperation:request];

    request = [[[ASIHTTPRequest alloc] initWithURL:[NSURL URLWithString:@"sdvdsvsadvsadv"]] autorelease];
    [request setDownloadDestinationPath:[[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"2.png"]];
    [request setDownloadProgressDelegate:imageProgressIndicator2];
    [request setUserInfo:[NSDictionary dictionaryWithObject:@"request2" forKey:@"name"]];
    [networkQueue addOperation:request];

- (void)imageFetchComplete:(ASIHTTPRequest *)request
{
    UIImage *img = [UIImage imageWithContentsOfFile:[request downloadDestinationPath]];
    if (img) {
        if ([imageView1 image]) {
            if ([imageView2 image]) {
                [imageView3 setImage:img];
            } else {
                [imageView2 setImage:img];
            }
        } else {
            [imageView1 setImage:img]; …
Run Code Online (Sandbox Code Playgroud)

asihttprequest ios

1
推荐指数
1
解决办法
2859
查看次数

关于ASIHTTPRequest发送请求

我正在使用ASIHTTPRequest [request startAsynchronous]functon向我的webservice api发送请求以登录.如果请求正常,则返回json值.然后我发送另一个请求来获取用户的信息,但在这里我收到一个错误.

这是我的代码:

-(void)login
{
    [usernameTextField resignFirstResponder];
    [passwordTextField resignFirstResponder];

    username = [usernameTextField text];
    password = [passwordTextField text];

    if ( ([username length] == 0 ) || ([password length] == 0 )) 
    {
       ...
    }
    else
    {
        NSString *URL = [NSString stringWithFormat:@"https://xxx.xxx.xx.xx/FMS/Pages/Service/FMService.svc/Login?user=%@&pass=%@",username,password];
        NSURL *requestURL = [NSURL URLWithString:URL];
        ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:requestURL];
        [request setValidatesSecureCertificate:NO];
        [request setDelegate:self];
        [request startAsynchronous];
    }
}

- (void)requestFinished:(ASIHTTPRequest *)request
{
    NSError *error = [request error];
    if (!error) 
    {
        NSString *responseString = [request responseString];
        NSDictionary *responseDict …
Run Code Online (Sandbox Code Playgroud)

asihttprequest ios

1
推荐指数
1
解决办法
1860
查看次数