Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_GeneratedPluginRegistrant"

Viewed 3794

I'm developing a Flutter app and getting this error. I have tried flutter clean, rm podfile, pod deintegrate, removed podfile.lock, but non seem to fix.

The full error message in Xcode is as follows:

Undefined symbols for architecture x86_64: "OBJC_CLASS$_GeneratedPluginRegistrant", referenced from: objc-class-ref in AppDelegate.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

2 Answers

I dumped the whole ios file and re-created it using flutter create . at the project directory level. I just dragged the "ios" folder to the trash, then ran the command above at the command line. I am guessing there was a file somewhere with an incorrect package name since I changed my package name to remove the "example" within the "com.example.". Note to self: choose one project name and leave it as is!

You might have this issue because of a project created pre 1.12. See this guide to upgrade.

Try these commands :

flutter upgrade
rm -f ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
rm -rf ios/Podfile ios/Podfile.lock ios/Pods ios/Runner.xcworkspace

in File-> Workspace Settings change the build system to New Build System

See this answer

Related