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

Sharing data is never available in the App [iOS] #133

Open
yurayavorski opened this issue Nov 28, 2024 · 7 comments
Open

Sharing data is never available in the App [iOS] #133

yurayavorski opened this issue Nov 28, 2024 · 7 comments

Comments

@yurayavorski
Copy link

yurayavorski commented Nov 28, 2024

Describe the bug
After setting up my app following the installation process I can't access any shared data in my app. The app is available in the list of sharing options, but after app is selected it navigates you to the app, but share intent hooks are never re-rendered and no data is available in the app. I tried both approaches with useShareIntent and ShareIntentProvider but neither works. Every time I refocus the application I see these logs in debug mode:

useShareIntent[active] refresh intent
 DEBUG  useShareIntent[refresh] null

To Reproduce
share any kind of data to the app, no data is available in the app

Environment
System:
OS: macOS 14.5
CPU: (12) arm64 Apple M2 Max
Memory: 87.31 MB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.19.1
path: ~/.nvm/versions/node/v18.19.1/bin/node
Yarn: Not Found
npm:
version: 10.2.4
path: ~/.nvm/versions/node/v18.19.1/bin/npm
Watchman:
version: 2024.07.15.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK: Not Found
IDEs:
Android Studio: 2023.3 AI-233.14808.21.2331.11926650
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java: Not Found
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.2
wanted: 0.74.2
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: true
newArchEnabled: false

Additional context
Add any other context about the problem here.

  • expo version (ex: 49) : 51
  • using firebase : no
  • using static build : tried both static build and eas
  • routing : tried both static and router-navigation
  • package version (ex: 1.2.0) : 2.5.2
  • platform target : iOS
  • device : real device
  • type: expo build
@davram88
Copy link

davram88 commented Dec 4, 2024

I am getting exactly the same issue as above, with the same environment as yours. It works good on android expo dev client, but the IOS is not working.

@achorein
Copy link
Owner

achorein commented Dec 6, 2024

can you give me your app.json configuration and from which app you try to share (what type of content ?)

@achorein
Copy link
Owner

achorein commented Dec 6, 2024

sounds lile a problem with Expo Linking (useLinkingURL), make sure you use this package in the top of your app.

@davram88
Copy link

davram88 commented Dec 7, 2024

`const IS_DEV = process.env.APP_VARIANT === 'development';
const IS_STAGING = process.env.APP_VARIANT === 'staging';
const IS_PRODUCTION = process.env.APP_VARIANT === 'production';

const SPLASH_CONFIG = {
backgroundColor: '#ffffff',
image: './assets/splash.png',
resizeMode: 'cover',
}
const DARK_SPLASH_CONFIG = {
backgroundColor: '#001429',
image: './assets/splash-dark.png',
resizeMode: 'cover',
}

const SPLASH_CONFIG_ANDROID = {
backgroundColor: '#0F52BA',
image: './assets/splash.png',
resizeMode: 'cover',
}
const DARK_SPLASH_CONFIG_ANDROID = {
backgroundColor: '#0f141b',
image: './assets/splash-dark.png',
resizeMode: 'cover',
}

export default {
name:
slug:
owner:
version: '2.0.2',
orientation: 'portrait',
primaryColor: '#ffffff',
icon: './assets/images/icon.png',
scheme:
userInterfaceStyle: 'automatic',
jsEngine: 'hermes',
splash: SPLASH_CONFIG,
notification: {
icon: './assets/ic_stat_onesignal_default.png',
color: '#ffffff'
},
assetBundlePatterns: [
'**/'
],
ios: {
userInterfaceStyle: 'automatic',
supportsTablet: false,
softwareKeyboardLayoutMode: 'pan',
bundleIdentifier:
googleServicesFile:
splash: {
...SPLASH_CONFIG,
dark: DARK_SPLASH_CONFIG,
},
config: {
usesNonExemptEncryption: false
},
infoPlist: {
NSFaceIDUsageDescription: 'Allow to use Face ID.',
NSCameraUsageDescription:
'Used for profile pictures, posts, and other kinds of content.',
NSMicrophoneUsageDescription:
'Used for posts and other kinds of content.',
NSPhotoLibraryAddUsageDescription:
'Used to save images to your library.',
NSPhotoLibraryUsageDescription:
'Used for profile pictures, posts, and other kinds of content',
CFBundleSpokenName: '',
},
runtimeVersion: {
policy: 'appVersion'
},
associatedDomains:
},
androidStatusBar: {
barStyle: 'light-content',
backgroundColor: '#00000000',
},
// Dark nav bar in light mode is better than light nav bar in dark mode
androidNavigationBar: {
barStyle: 'light-content',
backgroundColor: DARK_SPLASH_CONFIG_ANDROID.backgroundColor,
},
android: {
googleServicesFile: IS_DEV ? './google-services-dev.json' : IS_STAGING ? './google-services-staging.json' : './google-services.json',
package:
softwareKeyboardLayoutMode: 'pan',
userInterfaceStyle: 'automatic',
splash: {
...SPLASH_CONFIG_ANDROID,
dark: DARK_SPLASH_CONFIG_ANDROID,
},
adaptiveIcon: {
foregroundImage: './assets/images/adaptive-icon.png',
backgroundColor: '#ffffff'
},
permissions: [
'android.permission.USE_BIOMETRIC',
'android.permission.USE_FINGERPRINT'
],
intentFilters: [
{
action: 'VIEW',
autoVerify: true,
data: [],
category: ['BROWSABLE', 'DEFAULT']
}
]
},
plugins: [
[
"expo-image-picker",
{
"photosPermission": "The app accesses your photos to let you share them with your friends."
}
],
[
'onesignal-expo-plugin',
{
mode: IS_PRODUCTION ? 'production' : 'development',
smallIcons: ['./assets/ic_stat_onesignal_default.png'],
largeIcons: ['./assets/ic_onesignal_large_icon_default.png']
}
],
[
'expo-notifications',
{
icon: './assets/ic_stat_onesignal_default.png',
color: '#ffffff'
}
],
[
'expo-build-properties',
{
ios: {
useFrameworks: 'static'
}
}
],
'expo-localization',
[
'expo-local-authentication',
{
faceIDPermission: 'Allow to use Face ID.'
}
],
"@stream-io/video-react-native-sdk",
[
"@config-plugins/react-native-webrtc",
{
"cameraPermission": "Allow to access your camera",
"microphonePermission": "Allow to access your microphone"
}
],
[
"@sentry/react-native/expo",
{
"organization": "",
"project": "",
// If you are using a self-hosted instance, update the value of the url property
// to point towards your self-hosted instance. For example, https://self-hosted.example.com/.
"url": "https://sentry.io/"
}
],
[
'expo-share-intent',
{
"iosActivationRules": {
"NSExtensionActivationSupportsText": true,
"NSExtensionActivationSupportsWebURLWithMaxCount": 1,
"NSExtensionActivationSupportsWebPageWithMaxCount": 1,
"NSExtensionActivationSupportsImageWithMaxCount": 1,
"NSExtensionActivationSupportsMovieWithMaxCount": 1,
},
"androidIntentFilters": ["text/
", "image/*"]
}
],
'./plugins/withAndroidSplashScreenStatusBarTranslucentPlugin.js',
'expo-font',
'expo-secure-store',
'expo-asset'
],
extra: {
oneSignalAppId:
eas: {
projectId: ''
}
}
}
`

This is my app. config.js I removed sensitive data.. To your question, I did a test by going to yahoo finance and cnbc on safari and trying to share those articles.

As per your comment 'sounds lile a problem with Expo Linking (useLinkingURL), make sure you use this package in the top of your app.'. Do you mean on top of the App.tsx file?

@achorein
Copy link
Owner

@davram88 yes, using the ShareIntentProvider in the App.tsx is the safer usage.

your app.json looks great, just few things :

  • intentFilters should not be necessary in android section
  • i'm not sure that static build work greats (useFrameworks: 'static')

do you have a log with the correct scheme detected ?

 DEBUG  expoShareIntent[scheme] from expoConfig: <expo.scheme>

@yurayavorski
Copy link
Author

@achorein here is my app.config.json :

const APP_NAME = process.env.APP_NAME || 'playgroundapp.';

export default {
expo: {
name: process.env.EAS_BUILD_PLATFORM === 'android' ? APP_NAME.replace('.', '') : APP_NAME,
slug: process.env.SLUG || 'testplaygground-ai',
version:
process.env[${(process.env.EAS_BUILD_PLATFORM ?? 'ios').toUpperCase()}_VERSION] ||
process.env.VERSION ||
'0.0.1',
jsEngine: 'hermes',
owner: 'mainplayground',
scheme: 'testplaygground',
plugins: [
[
'expo-share-intent',
{
"iosActivationRules": {
"NSExtensionActivationSupportsImageWithMaxCount": 1,
},
"androidIntentFilters": ["image/*"]
},
],
[
'expo-build-properties',
{
ios: {
deploymentTarget: '14.0',
},
android: {
compileSdkVersion: 34,
targetSdkVersion: 34,
buildToolsVersion: '34.0.0',
minSdkVersion: 34,
},
},
],
['@react-native-google-signin/google-signin'],
[
'@sentry/react-native/expo',
{
organization: 'mainplayground-ai',
project: 'testplaygground-app',
},
],
[
'react-native-vision-camera',
{
cameraPermissionText: 'Allow "playgroundapp." to access your camera to generate your images',
enableMicrophonePermission: true,
microphonePermissionText:
'Allow "playgroundapp." to access your microphone to add a voice message when generating a playgroundapp',
enableLocation: false,
},
],
'@logrocket/react-native',
[
'expo-media-library',
{
photosPermission: 'Allow "playgroundapp." to access your photos to generate your images',
savePhotosPermission: 'Allow "playgroundapp." to save the generated images',
isAccessMediaLocationEnabled: true,
},
],
[
'expo-image-picker',
{
photosPermission: 'Allow "playgroundapp." to access your photos to generate your images',
cameraPermission: 'Allow "playgroundapp." to access your camera to generate your images',
},
],
[
'expo-notifications',
{
// Android.
icon: 'assets/android-notifications-icon.png',
color: '#FA00FF',
},
],
[
'expo-screen-orientation',
{
initialOrientation: 'PORTRAIT_UP',
},
],
'expo-font',
'expo-secure-store',
[
'airbridge-expo-sdk',
{
appName: 'mainplaygroundtestplaygground',
appToken: '0300bef888e74f1084c0498113749d0d',
},
],
'expo-apple-authentication',
[
'./plugin/custom-android-metadata',
{
snapchatClientId:
process.env.ANDROID_SNAPCHAT_CLIENT_ID || '4521637c-53be-43c1-b0d8-db55516f7032',
},
],
[
'expo-notification-service-extension-plugin',
{
mode: 'production',
iosNSEFilePath: './assets/ios/NotificationService.m',
devTeam: '7J35UKFJ83',
},
],
],
extra: {
eas: {
projectId: process.env.PROJECT_ID || 'da3aa86b-ec4e-4b57-81b5-be9f319a2351',
},
},
ios: {
usesAppleSignIn: true,
requireFullScreen: true,
bundleIdentifier: process.env.IOS_BUNDLE_ID || 'com.mainplayground.testplaygground-ai',
buildNumber: process.env.IOS_BUILD_NUMBER || '1',
entitlements: {
'com.apple.developer.usernotifications.communication': true,
'com.apple.developer.usernotifications.time-sensitive': true,
},
infoPlist: {
NSUserActivityTypes: ['INSendMessageIntent'],
NSLocationWhenInUseUsageDescription:
'We are using react-native-vision-camera to record a user video which requests this data. We do not store or process a location data',
LSApplicationQueriesSchemes: [
// Instagram.
'instagram-stories',
'instagram',
// Snapchat.
'snapchat',
'bitmoji-sdk',
'itms-apps',
// WhatsApp.
'whatsapp',
// FB Messenger.
'fb-messenger-api',
],
NSContactsUsageDescription: 'We use contacts to help you quickly find your friends!',
SCSDKClientId: process.env.SNAPCHAT_CLIENT_ID || '7bdf8fb4-f53d-4248-80e4-84b6270c7ee1',
},
privacyManifests: {
NSPrivacyAccessedAPITypes: [
{
NSPrivacyAccessedAPIType: 'NSPrivacyAccessedAPICategoryFileTimestamp',
NSPrivacyAccessedAPITypeReasons: ['C617.1', '0A2A.1', '3B52.1'],
},
{
NSPrivacyAccessedAPIType: 'NSPrivacyAccessedAPICategoryDiskSpace',
NSPrivacyAccessedAPITypeReasons: ['E174.1', '85F4.1'],
},
{
NSPrivacyAccessedAPIType: 'NSPrivacyAccessedAPICategoryUserDefaults',
NSPrivacyAccessedAPITypeReasons: ['CA92.1'],
},
{
NSPrivacyAccessedAPIType: 'NSPrivacyAccessedAPICategorySystemBootTime',
NSPrivacyAccessedAPITypeReasons: ['35F9.1'],
},
],
},
associatedDomains: ['applinks:app.theplaygroundappapp.com', 'applinks:mainplaygroundtestplaygground.airbridge.io'],
},
android: {
package: process.env.ANDROID_APP_ID || 'com.mainplayground.staging.testplaygground_ai',
googleServicesFile: './google-services.json',
versionCode: process.env.ANDROID_BUILD_NUMBER || '1',
permissions: [
'INTERNET',
'ACCESS_NETWORK_STATE',
'CAMERA',
'CAMERA_ROLL',
'MEDIA_LIBRARY',
'READ_EXTERNAL_STORAGE',
'WRITE_EXTERNAL_STORAGE',
'VIBRATE',
'WAKE_LOCK',
'READ_CONTACTS',
'RECEIVE_BOOT_COMPLETED',
'FOREGROUND_SERVICE',
'POST_NOTIFICATIONS',
'READ_MEDIA_IMAGES',
'READ_MEDIA_VIDEO',
'BILLING',
],
adaptiveIcon: {
foregroundImage: 'assets/android-foreground-icon.png',
backgroundImage: 'assets/android-background-icon.png',
monochromeImage: 'assets/android-monochrome-icon.png',
},
},
icon: 'assets/icon.png',
splash: {
backgroundColor: '#000000',
},
},
};

@achorein
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants