You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native中如何获取Facebook Messenger的Activity Type以加入排除列表

Fixing Facebook Messenger Crash with react-native-share

Hey there, sorry to hear you're hitting this crash with Facebook Messenger! Let's get this sorted out.

First, the activity type (bundle ID) you need to exclude for Facebook Messenger's share extension is almost always com.facebook.Messenger.ShareExtension. Let's start by adding that to your excludedActivityTypes list:

Update Your Excluded Activities

Modify your existing array to include the Messenger share extension ID:

excludedActivityTypes: [
  'com.linkedin.LinkedIn.ShareExtension',
  'com.apple.UIKit.activity.PostToFacebook',
  'UIActivityTypePostToTwitter',
  'com.apple.reminders.RemindersEditorExtension',
  'com.facebook.Messenger.ShareExtension' // Add this line
]

If that doesn't do the trick (sometimes bundle IDs can vary slightly), you can verify the exact activity type by logging all available share options when the sheet opens. Here's how to do that for iOS in a bare React Native project:

Verify the Exact Activity Type

  1. Open your project in Xcode and navigate to the native iOS code handling the share functionality (this might be in the react-native-share library's code or your custom implementation).
  2. Find where UIActivityViewController is created, then add this code to log all activity types:
    let activityViewController = UIActivityViewController(activityItems: shareItems, applicationActivities: nil)
    // Log every available activity type
    if let activities = activityViewController.availableActivities {
        for activity in activities {
            print("Found activity type: \(activity.activityType?.rawValue ?? "Unknown")")
        }
    }
    
  3. Run your app, trigger the share sheet, and check the Xcode console. Look for an entry mentioning Facebook Messenger—it will show you the precise bundle ID to add to your excluded list.

Quick Context

iOS third-party share extensions use their app's bundle ID as the activity type. By excluding Messenger's share extension, you're removing it from the share sheet entirely, which should stop the crash from happening.

内容的提问来源于stack exchange,提问作者Youcef EL KAMEL

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 04:12:59