[英]NSTask / Process deprecated methods and properties
In the most recent Apple documentation both NSTask
and Process
have several deprecated methods and properties, although there's nothing marked with an API Availability Macro
. 在Apple的最新文档中, NSTask
和Process
都具有多个不赞成使用的方法和属性,尽管没有使用API Availability Macro
标记。
Instance Properties 实例属性
@property(copy) NSString *launchPath;
@property(copy) NSString *currentDirectoryPath;
var launchPath: String? { get set }
var currentDirectoryPath: String { get set }
Instance Methods 实例方法
- (void)launch;
func launch()
Type Methods 类型方法
+ (NSTask *)launchedTaskWithLaunchPath:(NSString *)path
arguments:(NSArray<NSString *> *)arguments;
class func launchedProcess(launchPath path: String,
arguments: [String]) -> Process
There seemingly are no replacements available, so what gives? 似乎没有可用的替代品,那能给什么呢?
There seemingly are no replacements available 似乎没有替代品
There are, the API is now URL related 有,API现在与URL相关
Instance Properties 实例属性
@property(copy) NSURL *executableURL;
@property(copy) NSURL *currentDirectoryURL;
var executableURL: URL? { get set }
var currentDirectoryURL: URL? { get set }
Instance Methods 实例方法
- (BOOL)launchAndReturnError:(out NSError * _Nullable *)error;
func run() throws
Type Methods 类型方法
+ (NSTask *)launchedTaskWithExecutableURL:(NSURL *)url
arguments:(NSArray<NSString *> *)arguments
error:(out NSError * _Nullable *)error
terminationHandler:(void (^)(NSTask *))terminationHandler;
class func run(_ url: URL,
arguments: [String],
terminationHandler: ((Process) -> Void)? = nil) throws -> Process
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.