iphone - 如何连接 nsstring url

标签 iphone cocoa cocoa-touch url nsstring

如何连接 NSString URL?例如:

http://isomewebsite.com/username=[someuservariable]&password=[somevariable]

最佳答案

尝试使用下面的代码。

NSString* myURLString = [NSString stringWithFormat:@"somewebsite.com/username=%@&password=%@", myUserName,myPassword];
NSURL *url = [NSURL URLWithString:myURLString];

这里的博客教程将帮助您了解更多关于 Handling url authentication challenges accessing password protected servers

关于iphone - 如何连接 nsstring url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5741095/

相关文章:

ios - 如何使用 Apple 提供的图标

iphone - 有没有办法替换已经定义的预处理器标识符?

objective-c - NSApplescript 不会接受 initWithContentsOfURL

objective-c - NSURLConnection originalRequest 在 iOS 4 中抛出异常我可以用什么来代替?

iphone - iPhone试图让YouTube自动启动视频

iphone - 安全/加密的 PDF : iOS 4. 3 显示空白页

objective-c - 观察派生属性的变化: CALayer KVO example

macos - 在卸载或重新安装 Mac 应用程序时运行代码

ios - 动画 UIPopoverController

cocoa-touch - 在没有 UITabBar 或 UINavigationBar 的 iOS 中编排多个 View 的最佳方式?