Keith John Hutchison
Keith John Hutchison

Reputation: 5277

Breaking one line of objective-c code into two

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

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

yet

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

works.

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

Upvotes: 0

Views: 188

Answers (2)

synced
synced

Reputation: 51

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

Upvotes: 0

taskinoor
taskinoor

Reputation: 46027

*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

Upvotes: 3

Related Questions