物忘れの激しいエンジニアのメモ

スクレイピング、映像系、アプリ、webなど...

Expo (React Native) でios buildしようとしたらエラー (authentication with apple developer portal failed!)

エラーの内容

expoでios buildしようとしたら発生したエラー。

$ expo build:ios
Checking if there is a build in progress...

Please enter your Apple Developer Program account credentials. These credentials are needed to manage
certificates, keys and provisioning profiles in your Apple Developer account.
The password is only used to authenticate with Apple and never stored.
? Apple ID: MY_APPLE_ID
? Password (for MY_APPLE_ID): [hidden]
Trying to authenticate with Apple Developer Portal...
Authentication with Apple Developer Portal failed!
Reason: Unknown reason, raw: "SSL_connect returned=1 errno=0 state=error: certificate verify failed"
Error: Reason: Unknown reason, raw: "SSL_connect returned=1 errno=0 state=error: certificate verify failed"
    at runAction (/expo-cli@3.11.5/src/appleApi/fastlane.ts:28:17)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Object.authenticate (/expo-cli@3.11.5/src/appleApi/authenticate.ts:46:40)
    at IOSBuilder.getAppleCtx (/expo-cli@3.11.5/src/commands/build/ios/IOSBuilder.js:47:23)
    at IOSBuilder.produceMissingCredentials (/expo-cli@3.11.5/src/commands/build/ios/IOSBuilder.js:123:22)
    at IOSBuilder.prepareCredentials (/expo-cli@3.11.5/src/commands/build/ios/IOSBuilder.js:65:7)
    at IOSBuilder.run (/expo-cli@3.11.5/src/commands/build/ios/IOSBuilder.js:19:7)
    at IOSBuilder.command (/expo-cli@3.11.5/src/commands/build/BaseBuilder.js:55:7)
    at Command.<anonymous> (/expo-cli@3.11.5/src/exp.ts:81:7)

原因

bundle identifier(App Store内で使われるアプリのID)が同じで、slug(expo内で使われるアプリのID)が違うアプリが2つあることが原因のようでした。

app.json

{
  "expo": {
    ...
    "slug": "EXPO_APPLICATION_ID",         <- HERE
    ...
    "ios": {
      "bundleIdentifier": "APP_STORE_ID",  <- HERE
      ....
    }
  }
}

前に違うディレクトリで同様のアプリを作っており、今回最初から作り直したのですが、その2つのアプリのslugが違っていました。

解決策

前のslugに修正したところ、無事にビルドできました。

試してみて効果がなかったこと

  • rm -rf node_modules; yarn
  • PCの再起動

試してないので効果があるかも

動作環境

$ expo diagnostics

  Expo CLI 3.11.5 environment info:
    System:
      OS: macOS 10.14.3
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 12.10.0 - /usr/local/bin/node
      Yarn: 1.21.1 - /usr/local/bin/yarn
      npm: 6.13.6 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Android Studio: 3.4 AI-183.6156.11.34.5692245
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
    npmPackages:
      @types/react: ~16.9.0 => 16.9.17 
      @types/react-native: ~0.60.23 => 0.60.27 
      expo: ~36.0.0 => 36.0.2 
      react: ~16.9.0 => 16.9.0 
      react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4 
      react-navigation: ^4.0.10 => 4.0.10 
    npmGlobalPackages:
      expo-cli: 3.11.5