gpt4 book ai didi

ios - 如何通过 NSURLConnection 发送大字符串

转载 作者:可可西里 更新时间:2023-11-01 06:15:54 26 4
gpt4 key购买 nike

这是我的代码。

- (void)loadData:(NSString *)url {
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
NSLog(@"connection found---------");
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
NSLog(@"reciving data---------");
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
NSLog(@"connection fail---------");
[self.pddelegate connectionError];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSLog(@"data posting done---------");
[self.pddelegate dataPosted];
}

如果 url 变大并在日志中显示连接失败,则无法正常工作。

喜欢

url=@".......order_details&admin=29&tableid=89&waiter_id=18&items=MzQ6MSwxMToxLDMzOjEsNjc6MSwzOToxLDY5OjEsNTY6MSw2ODoxLDg6MSw1NToxLDYyOjEsNzY6MSw0MToxLDIwOjEsNjE6MQ=="

最佳答案

查看此 SO 帖子获取类型请求长度 What is the maximum length of a URL in different browsers?

要发送大字符串,请使用 POST 类型请求而不是 GET 类型。

关于ios - 如何通过 NSURLConnection 发送大字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16706381/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com