Open kevando opened 6 years ago
Nothing of note in device log and console log both?
@TheTekton No, I added the OS_ENV enable setting to the scheme and uncommented the log level in the .m file. Pods don't mess anything up? Like I need to include that into the share extension target?
I will try to get the sample project working before I comment again here.
Try my fork https://github.com/raindropio/react-native-share-extension It works for any app. I experienced many apps that not work with current version of this lib.
@kevando Any progress? If you get a sample going, I'll take a look. Pods shouldn't mess anything up. And you'd probably notice right away, if they were an issue, I think.
@kevando I ran into this exact issue and was able to figure out a way around it. I had to run the main react native app from xcode, wait for it to launch in the simulator, and then go back to xcode and run the share extension app, choosing safari as the app it runs from when prompted, and waiting for safari to launch. From there, I was able to share from Safari and the modal popped up as expected.
Getting RCTbridgeModule.h error using Detached from Expo Project In Demo Project Working Perfect .
Hey folks, I'm also stuck on the same issue.. any ideas?
any ideas guys it's very stuck ?!
Same deal here, anyone have any way whatsoever to get some sort of error message?
I've found that this issue arose after adding in the react-native-google-sign-in package. Is anyone else using this package and also having this issue?
Facing the same issue when trying to share something from Safari or Image Gallery. "react": "^16.0.0-beta.5", "react-native": "0.53.3", "react-native-share-extension": "^1.2.1"
same issue react native 0.45
same issue 😩 "react": "^16.3.2", "react-native": "^0.55.3", "react-native-share-extension": "^1.2.1"
solve the problem
my index file is index.js
not index.ios.js
, but in readme's MyShareEx.m is using index.ios
, so I need replace @"index.ios"
to @"index"
make sure App Transport Security Settings
has localhost's http request permission
Doing AppRegistry.registerComponent('MyExt', () => ShareComponent)
on a separate file seems to work for me. It's also needed to set the jsBundleURLForBundleRoot
to the new file where the extension is now being registered instead of index
. In my case the issue was with the Google SignIn module and doing this seems to fix it.
I'm facing the same issue... No way to make it work... Any advance?
same issue here......
@cdn34 Separating files worked for me !!! Thanks !!!
@nakamotoo I ended up changing the solution I posted here due to issues building the app for production, you may face similar issues. In case you do, what I did to fix those was to update my index.js
file to be the following :
import { AppRegistry } from "react-native";
AppRegistry.registerComponent('MyExt', () => require('./src/components/Share').default);
AppRegistry.registerComponent('App', () => require('./indexWrapper').default);
The contents of my original index.js
file are now located in indexWrapper.js
. This makes sure the extension only uses the modules it's actually requiring instead of the modules the main app is using.
@cdn34 Thanks. I tried to build the app for production , and as you told me, Safari froze.
Here are my index.js
and ShareExtension.js.
which I separated.
index.js
import { AppRegistry } from "react-native";
import App from "./src/App";
import { name as appName } from "./app.json";
AppRegistry.registerComponent(appName, () => App);
ShareExtension.js
import { AppRegistry } from "react-native";
import Share from "./src/components/Share.ios";
AppRegistry.registerComponent("ShareExtension", () => Share);
I've tried your solution and fix my index.js
like below but it didn't work...
import { AppRegistry } from "react-native";
import { name as appName } from "./app.json";
AppRegistry.registerComponent(
"Share",
() => require("./src/components/Share.ios").default
);
AppRegistry.registerComponent(appName, () => require("./src/App").default);
Could you please tell me how I should fix it ?
@nakamotoo In your project: Targets -> MyExt -> Build Phases -> Run Script
- Add :
export NODE_BINARY=node
../node_modules/react-native/scripts/react-native-xcode.sh
Also make sure to update the jsCodeLocation
in MyExt.m
to now point to your index
file like so:
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
@cdn34 Thanks for the reply, but actually I already have added the script.
The problem is that by separating the index.js
and ShareExtension.js
, the extension only works in dev environment.
After I fixed my index.js like above, the extension does not work even in dev environment.
And my ShareExtension.m file is like this, it points to
index
file.
#import <Foundation/Foundation.h>
#import "ReactNativeShareExtension.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <React/RCTLog.h>
@interface ShareExtension : ReactNativeShareExtension
@end
@implementation ShareExtension
RCT_EXPORT_MODULE();
- (UIView*) shareView {
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"ShareExtension"
initialProperties:nil
launchOptions:nil];
rootView.backgroundColor = nil;
// Uncomment for console output in Xcode console for release mode on device:
RCTSetLogThreshold(RCTLogLevelInfo - 1);
return rootView;
}
@end
@nakamotoo It's kind of hard to know what your current problem may be without any other information. I’ve also changed a lot things since then, so I don’t recall exactly if there were any other steps to fix the issue.
Other things I did at the time, not exactly sure if are related to your issue or not:
Targets -> MyExt -> Project Bundle Identifier
: { Set the correct one for each entry - Ex: com.app.dev.ext
} { Set the desired product name Ex: ext
}MyExt -> Info.plist
:
-- Bundle identifier : $(PRODUCT_BUNDLE_IDENTIFIER)
Product -> Scheme -> Edit scheme -> Build -> Pre-actions -> Run Script
:
-- Provide Build Settings from : your app
buildID=${PRODUCT_BUNDLE_IDENTIFIER}
extId="ext"
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $buildID.$extId" "${SRCROOT}/${extId}/Info.plist"
I also followed the tutorial for iOS (I only did the Setup iOS part), when I tried clicking on the share extension inside Safari, Safari froze and I see the following being printed on my Metro Bundler:
::1 - - [26/Nov/2018:22:57:30 +0000] "GET /index.bundle?platform=ios&dev=true&minify=false HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:57:35 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:57:39 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:00 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:05 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:09 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:13 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:17 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:21 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:25 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:29 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:33 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:37 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:22:58:41 +0000] "POST /symbolicate HTTP/1.1" 200 - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
...
It never stops printing the same line until I closed the Safari, and when I does it prints these:
::1 - - [26/Nov/2018:23:04:00 +0000] "POST /symbolicate HTTP/1.1" - - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:23:04:00 +0000] "POST /symbolicate HTTP/1.1" - - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:23:04:00 +0000] "POST /symbolicate HTTP/1.1" - - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
::1 - - [26/Nov/2018:23:04:00 +0000] "POST /symbolicate HTTP/1.1" - - "-" "MyShareEx/1 CFNetwork/974.2.1 Darwin/18.0.0"
These only gets printed for 4 times.
Has this issue been solved? I face the same issue
Great installation instructions. I think I followed them precisely and I get no response when I use the share icon in safari and nothing in the logs (even after uncommenting the debug line)
This is what happens: http://www.giphy.com/gifs/3o6fJgk6hzvRcamF4Q
If I am using pods, do I need to do anything extra to make that work?