Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find AppDelegate.m in xcode

I'm currently trying to implement Facebook SDK into my Unity App but I can't find the AppDelegate.m that I must modify in order to implement the SDK.

I tried searching everywhere in my Xcode folder but it seems nowhere to be found.

I search on google too but as I really don't understand anything to Xcode (except from building my Unity Project), I don't understand the answers too...

Thanks, and have a nice day !

like image 724
SamuelRousseaux Avatar asked Oct 17 '17 10:10

SamuelRousseaux


3 Answers

The file name “AppDelegate.m” is a generic reference to “the file that contains the definition of your application delegate class”. Your app is not required to name the file “AppDelegate.m” however, so you’ll need to find yours.

Somewhere in your app there is a class that implements the UIApplicationDelegate protocol. You should search for “UIApplicationDelegate” using Xcode’s search function. That should put you on the right track to finding the class. Whichever file that class is in is the file you need to refer to when other documentation says AppDelegate.m

Update:

I forgot that in objective-c you don't declare adoption of a protocol. Here is a different way to find your app delegate.

Find your main.m file (this file is required, so you'll definitely have one). It will contain code like this:

int main(int argc, char * argv[]) {
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([YourAppDelegateClassName class]));
    }
}

The interesting piece is [YourAppDelegateClassName class], since this represents the class of your application delegate. Do a search for the first word in the square brackets, in this case it is YourAppDelegateClassName.

like image 131
allenh Avatar answered Oct 16 '22 21:10

allenh


You can find it by searching UIApplicationDelegate in xcode search, then you will find the implemenation of this protocol in some file named as something.h.that's the file which you needed.

like image 36
Aravinth Avatar answered Oct 16 '22 21:10

Aravinth


In Xcode 13.3.1 the file would be the (AppName)App file. This file defines the entry point for the app. This file is where you would define the app delegate class.

like image 1
thejdah Avatar answered Oct 16 '22 19:10

thejdah