首页 > 解决方案 > Appdelegate.m 抛出错误

问题描述

我正在尝试在 xcode 上运行我的 react-native 项目,但不幸的是它开始为 Appdelegate.m 文件引发错误。

抛出的三个错误是:

  1. 方法“应用程序:didFinishLaunchingWithOptions:”的重复声明

  2. 预期表达

  3. 使用未声明的标识符“中心”

我尝试删除 appdelegate.m 文件以查看构建是否会刷新,但不幸的是它仍然抛出错误。下图为问题代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ...
  // Define UNUserNotificationCenter
  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
  center.delegate = self;

  return YES;
}

任何建议将不胜感激。该项目整个上午都在工作,似乎最近刚刚离开。

标签: iosxcodereact-native

解决方案


推荐阅读