braze-inc / braze-expo-plugin

Other
11 stars 10 forks source link

[Bug]: [iOS] Build error - 'Braze.Configuration.Push' has no member 'automation' #25

Closed quaos closed 9 months ago

quaos commented 9 months ago

Which Platforms?

iOS

Which React Native Version?

0.72.6

Which @braze/expo-plugin version?

1.2.0

Which @braze/react-native-sdk SDK version?

2.1.0

Repro Rate

100%

Steps To Reproduce

Example:

  1. Install SDK: npx expo install @braze/react-native-sdk@~2.1.0.
  2. Install Expo Plugin: npx expo install @braze/expo-plugin@^1.2.0.
  3. Add plugin to app.json:
     {
       // ...
       "plugins": [
        "@react-native-firebase/app",
        [
          "@braze/expo-plugin",
          {
            "androidApiKey": "YOUR-ANDROID-API-KEY",
            "iosApiKey": "YOUR-IOS-API-KEY",
            "baseUrl": "mock-braze.local",
            "sessionTimeout": 60,
            "enableGeofence": false,
            "enableBrazeIosPush": false,
            "enableFirebaseCloudMessaging": false,
            "firebaseCloudMessagingSenderId": "YOUR-FCM-SENDER-ID",
            "androidHandlePushDeepLinksAutomatically": true,
            "enableSdkAuthentication": false,
            "logLevel": 0,
            "minimumTriggerIntervalInSeconds": 0,
            "enableAutomaticLocationCollection": false,
            "enableAutomaticGeofenceRequests": false,
            "dismissModalOnOutsideTap": true,
            "androidPushNotificationHtmlRenderingEnabled": true,
            "androidNotificationAccentColor": "#ff3344",
            "iosRequestPushPermissionsAutomatically": false
          }
        ]
     }
  4. Prebuild: npx expo prebuild.
  5. Re-install Pods: cd ios && pod install --repo-update.
  6. Run the app in iOS Simulator: npx expo run:ios.

Expected Behavior

The app should build and run normally.

Actual Incorrect Behavior

The iOS build process exited with error: value of type 'Braze.Configuration.Push' has no member 'automation'

Verbose Logs

# expo run:ios
# ...

› Compiling @braze/react-native-sdk Pods/braze-react-native-sdk » BrazeReactBridge.m
› Compiling @braze/react-native-sdk Pods/braze-react-native-sdk » braze-react-native-sdk-dummy.m
› Compiling @braze/react-native-sdk Pods/braze-react-native-sdk » BrazeReactUtils.m
› Compiling @braze/expo-plugin Pods/ExpoAdapterBraze » BrazeAppDelegate.swift

❌  (node_modules/@braze/expo-plugin/ios/ExpoAdapterBraze/BrazeAppDelegate.swift:72:28)

  70 | 
  71 |       if let useBrazePush = plistConfig["UseBrazePush"] as? Bool, useBrazePush {
> 72 |         configuration.push.automation = true
     |                            ^ value of type 'Braze.Configuration.Push' has no member 'automation'
  73 |         configuration.push.automation.requestAuthorizationAtLaunch = false
  74 |       }
  75 | 

❌  (node_modules/@braze/expo-plugin/ios/ExpoAdapterBraze/BrazeAppDelegate.swift:73:28)

  71 |       if let useBrazePush = plistConfig["UseBrazePush"] as? Bool, useBrazePush {
  72 |         configuration.push.automation = true
> 73 |         configuration.push.automation.requestAuthorizationAtLaunch = false
     |                            ^ value of type 'Braze.Configuration.Push' has no member 'automation'
  74 |       }
  75 | 
  76 |       if let requestAuthorizationAtLaunch = plistConfig["RequestPushPermissionsAutomatically"] as? Bool,

❌  (node_modules/@braze/expo-plugin/ios/ExpoAdapterBraze/BrazeAppDelegate.swift:78:28)

  76 |       if let requestAuthorizationAtLaunch = plistConfig["RequestPushPermissionsAutomatically"] as? Bool,
  77 |          requestAuthorizationAtLaunch {
> 78 |         configuration.push.automation.requestAuthorizationAtLaunch = true
     |                            ^ value of type 'Braze.Configuration.Push' has no member 'automation'
  79 |       }
  80 | 
  81 |       let braze = BrazeReactBridge.perform(#selector(BrazeReactBridge.initBraze(_:)), with: configuration).takeUnretainedValue() as! Braze

› Compiling expo-splash-screen Pods/EXSplashScreen » EXSplashScreenModule.m
› Compiling expo-keep-awake Pods/ExpoKeepAwake » ExpoKeepAwake-dummy.m
› Compiling @braze/expo-plugin Pods/ExpoAdapterBraze » ExpoAdapterBraze-dummy.m

# ... warnings about "Script has ambiguous dependencies causing it to run on every build."

› 3 error(s), and 3 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.
error Command failed with exit code 1.

Additional Information

I'm trying to install Braze SDK in my Expo/React Native project, according to the documentation, but get stuck here when trying to run on iOS.

Other Lib Versions

jerielng commented 9 months ago

Hey @quaos, thanks for raising this! It looks like you'll need to update your React Native SDK version to 8.2.0 since this is related to the new push automation features that are contained within that version.

If you are unable to upgrade your Braze React Native SDK version, could you use version 1.1.2 of the Expo Plugin?

We'll make a note to call this out in the changelog.

quaos commented 9 months ago

Hey @quaos, thanks for raising this! It looks like you'll need to update your React Native SDK version to 8.2.0 since this is related to the new push automation features that are contained within that version.

If you are unable to upgrade your Braze React Native SDK version, could you use version 1.1.2 of the Expo Plugin?

We'll make a note to call this out in the changelog.

Thanks! It works now!

npx expo install @braze/react-native-sdk@^8.2.0

npx expo prebuild

cd ios

rm -fR Podfile.lock

pod install --repo-update