gpt4 book ai didi

iphone - 不兼容的指针类型将 'NSURL *__strong' 发送到类型为 'NSString *' 的参数

转载 作者:行者123 更新时间:2023-11-29 13:19:24 25 4
gpt4 key购买 nike

NSString *urlString = [NSString stringWithFormat:@"http://shareaspetto.com/share/updateprofile.php?name=%@&gender=%@&email=%@&about_us=%@&id=%@&image=%@", nameString, genderString, emailString, aboutusString, idString, imgNameString];
NSLog(@"urlString = %@", urlString);
while ([urlString rangeOfString:@" "].location != NSNotFound) {
urlString = [urlString stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
}
NSString *rplyString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];

当我编译上面的代码时,警告 Incompatible pointer types sending 'NSURL *__strong' to parameter of type 'NSString *' 发生了。

最佳答案

使用 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding 隐藏字符串

NSString *urlString = [NSString stringWithFormat:@"http://shareaspetto.com/share/updateprofile.php?name=%@&gender=%@&email=%@&about_us=%@&id=%@&image=%@", nameString, genderString, emailString, aboutusString, idString, imgNameString];
urlString = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
NSLog(@"urlString = %@", urlString);
while ([urlString rangeOfString:@" "].location != NSNotFound) {
urlString = [urlString stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
}

NSString *rplyString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];

关于iphone - 不兼容的指针类型将 'NSURL *__strong' 发送到类型为 'NSString *' 的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14744454/

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