Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
165 stars 142 forks source link

#import "Appboy-iOS-SDK/AppboyKit.h" not found? #308

Closed devshorts closed 3 years ago

devshorts commented 3 years ago

Report

I'm following the react native integration outlines here for podspec based installs

https://www.braze.com/docs/developer_guide/platform_integration_guides/react_native/ios/sdk_integration/

Which first links to the ios sdk integration link (note, the link linked to in the docs: https://www.braze.com/docs/developer_guide/platform_integration_guides/ios/initial_sdk_setup/ is wrong...)

The ios sdk integration links says to add

#import "Appboy-iOS-SDK/AppboyKit.h"

But xcode just complains that it can't find it.

After some digging I ended up doing

#import <AppboyKit.h>
#import <AppboyReactUtils.h>

Which made the following two lines compile:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
....
  // Braze
  [Appboy startWithApiKey:@"YOUR-APP-IDENTIFIER-API-KEY"
          inApplication:application
          withLaunchOptions:launchOptions];
  [[AppboyReactUtils sharedInstance] populateInitialUrlFromLaunchOptions:launchOptions];

I'm not a native ios dev so I'm not sure if this is even right, but otherwise I'd need some guidance on what is the right import to pull in

Describe your environment.

Info Value
Platform Name e.g. iOS
Platform Version e.g. 12.1
SDK Version e.g. 3.10.0
Integration Method e.g. Cocoapods
Xcode Version e.g. Xcode 12.5.1
  "name": "react-native-appboy-sdk",
  "version": "1.31.0",
Bucimis commented 3 years ago

@devshorts could you post your header search paths (HEADER_SEARCH_PATHS)? They should include a path to the Appboy pod's public headers

devshorts commented 3 years ago

@Bucimis seems like these two items were added automatically as part of the auto linking. (Is there an easy way to copy the full list of search paths in xcode?)

image ("${PODS_CONFIGURATION_BUILD_DIR}/Appboy-iOS-SDK/Appboy_iOS_SDK.framework/Headers")

image

For what its worth, importing the two headers as mentioned in the original report did work, I was able to verify we are sending some sample data to the dashboard from our react native app

Bucimis commented 3 years ago

@devshorts do you have !use_frameworks in your Podfile? And yep, it should actually work either way - the import syntax will depend on how the SDK was ultimately compiled based on your configuration

devshorts commented 3 years ago

@Bucimis yes we have

use_frameworks! :linkage => :static
Bucimis commented 3 years ago

@devshorts 👍 that's almost certainly the reason, the SDK should function fine either way. we'll close this out for now, let us know if anything else comes up!

ivannzme commented 5 months ago

Run into the same issue, has this been resolved? I am on 1.37.0

hokstuff commented 5 months ago

Hi @ivannzme,

Version 1.37.0 of AppboyKit is a very old version, and AppboyKit itself has just passed end-of-support as of March 1, 2024, meaning we will no longer be developing on it nor fixing critical bugs on the repo. I encourage you to either see if the latest version of AppboyKit 4.7.0 addresses your issues or to migrate to the Swift SDK, which will resolve the issue you are facing.

Thanks.