NSURL 没有使用 NSString 分配 [英] NSURL not getting allocatd with NSString

查看:56
本文介绍了NSURL 没有使用 NSString 分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很奇怪,因为我在程序中的所有其他 NSUrls 都正常工作,但是这个没有分配给 NSString.我正在使用:

This' strange because all my other NSUrls in program are working properly but this one isn't getting allocated with NSString. I'm using:

urlStr_ = [NSString stringWithFormat:@"http://192.168.10.2/justmeans/trunk/appaddgoodwork?gencode=%@&deviceid=@%@&sessionkey=%@&userid=%@&updatetext=%@&companyid=%d&service_type=%@",securitycode,deviceId,sessionKey,userId,finalTextInTxtVw,companyId,service_type];
urlStr_ = [urlStr_ stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)NSUTF8StringEncoding];

url_ = [[NSURL alloc] initWithString:urlStr_];

NSUrl 没有被分配的可能原因是什么?有人可以帮忙吗?

What are the possible reasons for NSUrl not getting allocated? Can anybody please help?

提前谢谢.

附言NSString 不为空.

P.S. NSString is not empty.

推荐答案

该字符串的格式似乎不正确.参见 %@&deviceid=@%@&sessionkey 部分;不应该是%@&deviceid=%@&sessionkey吗?

The string seems to not be correctly formatted. See the %@&deviceid=@%@&sessionkey part; should not it be %@&deviceid=%@&sessionkey?

这篇关于NSURL 没有使用 NSString 分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆