Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rich Push iOS issue : 'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead. #141

Closed
3 of 4 tasks
youcefswoo opened this issue Apr 2, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@youcefswoo
Copy link

Checklist

  • I have read the contributing guidelines
  • I have determined whether this bug is also reproducible in a vanilla project, such as the example app in this repository.
  • If possible, I've reproduced the issue using the master branch or latest release of this package.
  • This issue hasn't been addressed in an existing issue or pull request

Description

I was attempting to integrate rich notifications. I followed the instructions step by step in the iOS documentation. I created the Notification Service Extension as mentioned. However, when I downloaded the KlaviyoSwiftExtension using CocoaPods, I encountered the error and couldn't build the project.

Expected behavior

I expected the build to be successful.

Actual behavior

Build error :'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.

Steps to reproduce

Follow the steps to integrate Rich Push.

The Klaviyo React Native SDK version information

0.3.1

Environment Description

react native 0.73.3

@youcefswoo youcefswoo added the bug Something isn't working label Apr 2, 2024
@youcefswoo youcefswoo changed the title Rich Push iOS issue : shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead. Rich Push iOS issue : 'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead. Apr 3, 2024
@ajaysubra
Copy link
Collaborator

@youcefswoo could you please share your podfile?

@youcefswoo
Copy link
Author

youcefswoo commented Apr 4, 2024

@youcefswoo could you please share your podfile?
@ajaysubra this my Podfile.

image

I m using firebase and react-native-permissions. and for the name of the extension it's RichNotification.

@youcefswoo
Copy link
Author

@ajaysubra
And this is the error that I encounter in the KlaviyoEnvironment struct when attempting to build the project.
image

@ajaysubra
Copy link
Collaborator

Thanks for sharing your podfile. Can you try moving the extension target outside your app target like indicated in step 3 of the iOS installation guide here?

Example of what worked for me in the example app:

target 'KlaviyoReactNativeSdkExample' do
  config = use_native_modules!

  use_frameworks! :linkage => :static

  use_react_native!(
    :path => config[:reactNativePath],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
#    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'KlaviyoReactNativeSdkExampleTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
  end
end

target 'KlaviyoReactNativeSdkExampleExtension' do
  use_frameworks! :linkage => :static
  pod 'KlaviyoSwiftExtension'
end

@youcefswoo
Copy link
Author

@ajaysubra After updating the podfile to

image

i got this new build error

Cycle inside APP_NAME; building could produce unreliable results.

@ajaysubra
Copy link
Collaborator

ajaysubra commented Apr 9, 2024

@ajaysubra After updating the podfile to

image i got this new build error

Cycle inside APP_NAME; building could produce unreliable results.

@youcefswoo I created a PR here in the example app that uses KlaviyoSwiftExtension in the podfile. I tested this locally and it seems to work. I have not seen that build error on my end when trying to use extension pod.

@youcefswoo
Copy link
Author

@ajaysubra I will check it and update you soon.

@youcefswoo
Copy link
Author

@ajaysubra After reviewing the example and following it step by step, I had the same build issue here. I resolved the issue with this suggestion Thanks for your support.

@ajaysubra
Copy link
Collaborator

@youcefswoo Thanks for posting your solution here. Closing this issue now. Feel free to reach out if you need anything else.

@youcefswoo
Copy link
Author

@ajaysubra thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants