开发者

Breaking one line of objective-c code into two

开发者 https://www.devze.com 2023-01-17 17:34 出处:网络
NSDictionary *attributes = nil ; *attributes = [filemanager attributesOfItemAtPath:path error:nil] ; fails with \" ... error: incompatible types in assignment\"
NSDictionary *attributes = nil ;
*attributes = [filemanager attributesOfItemAtPath:path error:nil] ;

fails with " ... error: incompatible types in assignment"

yet

NSDictionary *attributes = [filemanager attr开发者_运维技巧ibutesOfItemAtPath:path error:nil] ;

works.

My question is how to break the one line of code that works into two lines of code that works.


*attributes = [filemanager attributesOfItemAtPath:path error:nil] ;

Delete that '*' from the start of the line. You don't need it. Correct will be:

attributes = [filemanager attributesOfItemAtPath:path error:nil] ; // no '*' before attributes


NSDictionary *attributes;
attributes = [filemanager attributesOfItemAtPath:path error:nil];
0

精彩评论

暂无评论...
验证码 换一张
取 消