【问题标题】:NSTask not working as expected / hoped forNSTask 没有按预期/希望工作
【发布时间】:2014-12-14 13:38:32
【问题描述】:

get_iplayer 允许用户从 BBC iPlayer 服务下载文件。太棒了,他们俩都是。

我正在尝试使用 NSTask 从 Xcode 中运行 get_iplayer 命令:

NSTask *task = [[NSTask alloc] init];
[task setLaunchPath:@"/users/myuser/documents/get_iplayer_install/get_iplayer"];
NSArray *args = @[@"--type=radio",@"--pid",  @"--modes=flashaacstd,rtspaaclow",  @"b006tnvx"];
[task setArguments:args];
[task launch];
[task waitUntilExit];

这与我从终端运行时的工作相同:

get_iplayer --type=radio --pid b006tnvx

但是,它会产生以下输出:

get_iplayer v2.90, Copyright (C) 2008-2010 Phil Lewis
This program comes with ABSOLUTELY NO WARRANTY; for details use --warranty.
This is free software, and you are welcome to redistribute it under certain
conditions; use --conditions for details.

WARNING: rdf URL contained no data
WARNING: PID URL contained no RDF data. Trying to record PID directly.
INFO: Trying pid: --modes=flashaaclow using type: radio
INFO: Trying to stream pid using type radio
INFO: pid not found in radio cache
Matches:

INFO: 1 Matching Programmes

ERROR: Failed to get version pid metadata from iplayer site

WARNING: rdf URL contained no data
WARNING: PID URL contained no RDF data. Trying to record PID directly.
INFO: Trying pid: flashaacstd using type: radio
INFO: Trying to stream pid using type radio
INFO: pid not found in radio cache
Matches:

INFO: 1 Matching Programmes

ERROR: Failed to get version pid metadata from iplayer site

Program ended with exit code: 0

而它应该产生一些类似的东西:

我不认为这是一个 get_iplayer 问题,这是我对 NSTask 以及可能是 unix 的工作原理缺乏了解。

你能指出我正确的方向吗?

干杯, 安迪

【问题讨论】:

标签: objective-c macos terminal nstask


【解决方案1】:

您的论点顺序错误。你有 --modes 参数和值在 --pid 参数之间的值。

输出说明它找不到名称为 --modes=flashaaclow 的 pid

【讨论】:

    猜你喜欢
    • 2021-10-19
    • 2020-03-18
    • 2012-06-14
    • 2014-11-15
    • 1970-01-01
    • 2012-07-02
    • 2011-09-07
    • 2013-03-03
    • 2015-05-18
    相关资源
    最近更新 更多