Deprecated

有时候我们在网上遇到的一些代码运行时,可能会出现这样的warning:"****"is deprecated .出现这个警告的原因是苹果公司对这些函数进行升级和改进,或者说对那些函数进行功能优化。我们需要去开发文档中查询我们用到的函数,将出现这种警告的函数换成苹果公司新提供的函数。

例如下面两个函数:

fileAttributesAtPath:traverseLink:

Returns a dictionary that describes the POSIX attributes of the file specified at a given.

 (Deprecated in Mac OS X v10.5. Use attributesOfItemAtPath:error: instead.)

- (NSDictionary *)fileAttributesAtPath:(NSString *) path traverseLink:(BOOL) flag
Parameters
path

A file path.

flag

If path is not a symbolic link, this parameter has no effect. If path is a symbolic link, then:

  • If YES the attributes of the linked-to file are returned, or if the link points to a nonexistent file the method returns nil.

  • If NO, the attributes of the symbolic link are returned.

Return Value

An NSDictionary object that describes the POSIX attributes of the file specified at path. The keys in the dictionary are described in “File Attribute Keys”. If there is no item at path, returns nil.


directoryContentsAtPath:

Returns the directories and files (including symbolic links) contained in a given directory. (Deprecated in Mac OS X v10.5. Use contentsOfDirectoryAtPath:error: instead.)

- (NSArray *)directoryContentsAtPath:(NSString *) path
Parameters
path

A path to a directory.

Return Value

An array of NSString objects identifying the directories and files (including symbolic links) contained in path. Returns an empty array if the directory exists but has no contents. Returns nil if the directory specified at path does not exist or there is some other error accessing it.

Discussion

The search is shallow and therefore does not return the contents of any subdirectories. This returned array does not contain strings for the current directory (“.”), parent directory (“..”), or resource forks (begin with “._”) and does not traverse symbolic links.

Special Considerations

Because this method does not return error information, it has been deprecated as of Mac OS X v10.5. Use contentsOfDirectoryAtPath:error: instead.

在ios5.0之后,dismissModalViewControllerAnimated方法被 dismissViewControllerAnimated:completion:方法所取代.后者比前者多了一个(void (^)(void))completion参数,这个参数是一个block用来提供UIViewcontroller对象被释放之后运行的回调.这个block的回调方法是在UIViewcontroller的viewDidDisappear: 之后被调用.  与以上的两个方法对应的方法是presentModalViewController:animated:和presentViewController:animated:completion:.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值