【问题标题】:stringByAppendingPathComponent: in Xcode 7 beta 5stringByAppendingPathComponent:在 Xcode 7 beta 5 中
【发布时间】:2015-11-26 02:00:37
【问题描述】:

在 Xcode 7(beta 5)的最新版本中,NSString 方法 stringByAppendingPathComponent: 已被完全删除。这在处理文件路径时非常有用

是否有新的方法来替代这个或实现类似的功能?

【问题讨论】:

标签: ios xcode nsstring xcode7 xcode7-beta5


【解决方案1】:

它被移除到 NSURL,你可以使用这个:

  NSURL(string: yourPath)!.URLByAppendingPathComponent(pathComponent)

或者为了最大的兼容性

 NSString(string: yourPath).stringByAppendingPathComponent(pathComponent)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-05
    相关资源
    最近更新 更多