为什么“OneSignalNotificationServiceExtension”会导致我的世博项目构建错误?

问题描述 投票:0回答:1

我在我的博览会项目中安装了这 2 个库:

    "onesignal-expo-plugin": "^2.0.2",
    "react-native-onesignal": "^5.0.2",

当我使用 eas 构建我的应用程序时,它崩溃并给我以下消息:

2023-11-02 17:14:46.173 xcodebuild[4915:14212] warning:  The file reference for "OneSignalNotificationServiceExtension" is a member of multiple groups ("Pods" and ""); this indicates a malformed project.  Only the membership in one of the groups will be preserved (but membership in targets will be unaffected).  If you want a reference to the same file in more than one group, please add another reference to the same path.

导致此错误的原因是什么以及如何修复它?

expo onesignal
1个回答
0
投票

更新至2.0.3。或者如果你不更新,你必须添加一个插件,通过使用插件来删除它:

app.json/app.config.js

{
  "expo": {
    //...
    "plugins": [
      [
        "onesignal-expo-plugin",
        {
          // ...
        },
      ],
      "./plugins/ios-config",
      "...",
    ],
  }
}

插件/ios-config/index.js

const {withXcodeProject} = require('@expo/config-plugins')

module.exports = function withIosConfig(config) {
  return withXcodeProject(config, _config => {
    const xcodeProject = _config.modResults
    
    // fix issue that OneSignalNotificationServiceExtension appeared in Pods group
    const groups = xcodeProject.hash.project.objects.PBXGroup
    for (let key in groups) {
      const group = groups[key]
      if (group.path === 'Pods') {
        const groupChildren = group.children
        for (let i in groupChildren) {
          const item = groupChildren[i]
          if (item.comment === 'OneSignalNotificationServiceExtension') {
            console.log(
              'Found duplicate of OneSignalNotificationServiceExtension in project.pbxproj',
            )
            groupChildren.splice(i, 1)
            break
          }
        }
      }
    }

    return _config
  })
}

© www.soinside.com 2019 - 2024. All rights reserved.