开发者

how to resolve warning implicit declaration of function in Objective C

开发者 https://www.devze.com 2022-12-20 05:36 出处:网络
log warning: implicit declaration of function \'TutorialAlertWithMessageAndDelegate\' here my code .h void TutorialAlertWithMessageAndDelegate(NSString *title, NSString *message, id delegate);

log

warning: implicit declaration of function 'TutorialAlertWithMessageAndDelegate'

here my code

.h

void TutorialAlertWithMessageAndDelegate(NSString *title, NSString *message, id delegate);


.m
void TutorialAlertWithMessageAndDelegate(NSString *title, NSString *message, id delegate)
{
    /* open an alert with OK and Cancel buttons */
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title 
                                                    message:message
                                                   delegate:delegate 
                                          cancelButtonTitle:@"Dism开发者_开发问答iss"
                                          otherButtonTitles: @"Show Tutorial", @"Disable Tutorial", nil];
    // otherButtonTitles: @"Show Next Tip", @"Disable Tips", nil];
    [alert show];
    [alert release];
}


That warning is generated when you try to call a function before declaring it. Your declaration in the header (.h) file seems to be correct, but you are probably not including that header file in the source file that is calling the function. Be sure to put:

#include "Tutorial.h" // replace with actual filename, of course

at the top of that source file.

0

精彩评论

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

关注公众号