在 NSScriptCommand 中
我创建了一个 NSScriptCommand
的子类,用它我可以获取我的 URI。
它运行良好,通过 [self directParameter]
我得到了 url。
现在我找到了很棒的方法[self argument]
。
if([self isWellFormed] == YES) {
NSLog(@"is well formed");
NSDictionary *dic = [self arguments];
NSLog(@"dic = %@", dic);
}
但是 dic 是空的。 =( 另外,当 URL 类似于 myAppUri:foo/bar?a=b#haha
...
我要做什么来识别这个该死的参数?
道路:
MyApp[39851:813] [self commandDescription] = Command: GetURL ('GURL'/'GURL') Implementation class: URLHandlerCommand Name: , description: Result type: ('null') Description:
I've created a subclass of NSScriptCommand
with wich I get my URI.
It works well and with [self directParameter]
I get the url.
Now I found the great method [self arguments]
.
if([self isWellFormed] == YES) {
NSLog(@"is well formed");
NSDictionary *dic = [self arguments];
NSLog(@"dic = %@", dic);
}
But dic
is empty. =( Also when the URL is something like myAppUri:foo/bar?a=b#haha
...
What I've to do for recognizing this damn arguments?
By the way:
MyApp[39851:813] [self commandDescription] = Command: GetURL ('GURL'/'GURL') Implementation class: URLHandlerCommand Name: , description: Result type: ('null') Description:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GetURL 仅接受一个参数,即它的直接参数。 该命令不接受关键字参数,因此字典当然是空的。
如果您想要 URL 的查询字符串参数,那么您需要从 URL 字符串创建一个 NSURL,然后向 URL 发送
query
消息,然后自己解析它(可能使用 NSScanner)。GetURL only takes one argument, which is its direct parameter. The command takes no keyword arguments, so of course the dictionary is empty.
If you want the URL's query string arguments, then you need to create an NSURL from the URL string, then send the URL the
query
message, then parse that yourself (probably using NSScanner).