RNAppAuth,iOS构建失败,未知类型名称'namespace',react-native-app-auth

时间:2018-04-24 12:44:19

标签: ios reactjs react-native expo appauth

我正在尝试将react-native-app-auth添加到现有的,但很新的项目与世博会。 我正在按照您的设置指南进行操作,因此请执行以下步骤:

  • yarn add react-native-app-auth@2.2.0 --dev
  • 添加pod 'AppAuth', '>= 0.91'
  • cd iso && pod install
  • react-native link(编辑:来自项目的根路径)

我得到了:

rnpm-install info Linking react-native-app-auth ios dependency
rnpm-install WARN ERRGROUP Group 'Libraries' does not exist in your Xcode project. We have created it automatically for you.
rnpm-install info Platform 'ios' module react-native-app-auth has been successfully linked

看起来不错。

然后当我在XCode中构建时,我收到以下错误:

image

在搜索网页后,我发现它可能与编译器有关,我用Objective-C ++改了它:

image

现在我收到更多错误:

image

我也尝试过:

  • 将目标版本更改为9.0
  • 再做一次
  • 祈祷

没有任何帮助:( Xcode版本9.3(9E145)

app.js

{
    "expo": {
        "sdkVersion": "26.0.0",
        "ios": {
        "bundleIdentifier": "com.xxx.xxx",
        "publishBundlePath": "ios/mobile-xxx/Supporting/shell-app.bundle",
        "publishManifestPath": "ios/mobile-xxx/Supporting/shell-app-manifest.json"
        },
        "android": {
        "package": "com.xxx.xxx"
        },
        "name": "mobile-xxx",
        "slug": "mobile-xxx",
        "version": "0.1.0",
        "isDetached": true,
        "entryPoint": "./index.js",
        "detach": {
        "scheme": "exp997ce9c6b4fd43cfa14f4eede063ecf5",
        "iosExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/ios-v2.4.4-sdk26.0.0-3bd935c7-cdd3-4002-8e44-4df857a675f2.tar.gz",
        "androidExpoViewUrl": "https://s3.amazonaws.com/exp-exponent-view-code/android-v2.4.0-sdk26.0.0-e63d9209-070c-4118-b06b-c60e82da0b66.tar.gz"
        }
    }
}

package.js

{
    "name": "mobile-xxx",
    "version": "0.1.0",
    "private": true,
    "devDependencies": {
        "jest-expo": "26.0.0",
        "react-native-app-auth": "2.2.0",
        "react-test-renderer": "16.3.0-alpha.1"
    },
    "main": "node_modules/expo/AppEntry.js",
    "scripts": {
        "test": "jest"
    },
    "jest": {
        "preset": "jest-expo"
    },
    "dependencies": {
        "expo": "^26.0.0",
        "prop-types": "^15.6.1",
        "react": "16.3.0-alpha.1",
        "react-native": "https://github.com/expo/react-native/archive/sdk-26.0.0.tar.gz",
        "react-native-app-auth": "^2.2.0",
        "react-native-router-flux": "^4.0.0-beta.28",
        "react-redux": "^5.0.7",
        "redux": "^3.7.2"
    }
}

更新:我刚刚在this指南后设置了一个全新的Expo应用,并且出现了完全相同的错误。

1 个答案:

答案 0 :(得分:0)

问题是在头搜索路径中有一个导入,它在整个dateA = moment(itemA.date, "MM-DD-YYYY"); // replace format by your one dateB = moment(itemB.date, "MM-DD-YYYY"); if (dateA.diff(dateB) > 0) { // do something if A is later than B } else { // do something if B is later that A } 文件夹中进行搜索: /ios

如果您恰巧使用Expo和CocoaPods,则Pods文件夹中将有$(SRCROOT)/../../../ios/**作为依赖项。实际上,任何依赖于升压的封装都会导致此问题。 XCode也尝试构建boost,但是它具有一些非ObjC文件,因此将失败。

要解决此问题:

打开RNAppAuth.xcodeproj,切换到“构建设置”选项卡并搜索标题搜索路径。将行boost-for-react-native替换为

$(SRCROOT)/../../../ios/**

请注意,使用npm install(或yarn)后,这些更改将消失。要使这些更改永久生效,可以使用patch-package

编辑:此问题已得到解决,使用该软件包的最新版本应该可以正常工作。