简体   繁体   中英

iOS warning: Implicit declaration of function 'pathInDocumentDirectory'

I'm getting an " Implicit declaration of function 'pathInDocumentDirectory' " warning for this line of code while trying to develop my first iPhone app:

NSString *imagePath = pathInDocumentDirectory(s);

Strangely, I can't find any good information on what to do about this. Does anyone know how to get rid of the warning? Thanks!

If that is an inline function, move the declaration to the top of the implementation file (before anything uses it).

If it's a method you've written it should be an objective-c method...

-(NSString *)pathInDocumentDirectory:(NSString *)value {

}

Then you use...

NSString *path = [self pathInDocumentsDirectory:aValue];

Don't forget to declare the method in either the header or a private category in the implementation file.

Make sure you have import or include the header file which contains pathInDocumentDirectory function. OR If pathInDocumentDirectory function is in the same file,just put it before the function where you used.Or just declare the pathInDocumentDirectory at first。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM