alinz / react-native-share-extension

react-native as an engine to drive share extension
MIT License
765 stars 401 forks source link

How to Get Extension to Show up In Safari Share #52

Closed Faolain closed 7 years ago

Faolain commented 7 years ago

Hey great work Alinz. I followed all the instructions for installation and the build succeeded. However I'm having trouble seeing the extension show up when I press "Share" on Safari on the iOS Simulator. I press "More" and see the only default apps of Facebook, Twitter, and Reminders. How do I make my extension show up there? Is there a particular file which I should double check to make sure is edited?

alinz commented 7 years ago

if you can't see the extension app show up then you might have done/missed something during creating a new new share extension here. double check the doc. if you couldn't be able to resolve it send me the example repo and I will look into it

Faolain commented 7 years ago

Thanks alinz! I went over the steps again...and now it pops up. I guess it's possible I simply missed something although I had already gone over the steps twice before. As a follow-up question I used the extension example you have with the modal but when selected in the simulator, nothing happens. In addition the safari browser page seems to be "locked" until I refresh the page. Have you encountered this before?

When I try in Xcode to Debug -> Attach to Pid/Process and Select the Extension I get a "Could not attach to pid: "15187" Unable to Attach" wherein the simulator restarts into an ios7 plus. I tried looking at the simulator system logs but am not really sure what is of importance. It seems to think I don't have a bundle url present but the application itself works fine, and the js file I'm using is essentially the same as yours.

Aug 13 13:37:50 Faolains-MacBook-Pro SlinqExt[15541]: Failed to inherit CoreMedia permissions from 15535: (null)
Aug 13 13:37:50 Faolains-MacBook-Pro SlinqExt[15541]: Initializing <RCTBatchedBridge: 0x6080001b5e00> (parent: <RCTBridge: 0x6080000cca20>, executor: RCTJSCExecutor)
Aug 13 13:37:50 Faolains-MacBook-Pro SlinqExt[15541]: Failed to load source: Error Domain=RCTErrorDomain Code=0 "No bundle URL present.

    Make sure you're running a packager server or have included a .jsbundle file in your application bundle." UserInfo={NSLocalizedDescription=No bundle URL present.

    Make sure you're running a packager server or have included a .jsbundle file in your application bundle.}
Aug 13 13:37:50 Faolains-MacBook-Pro SlinqExt[15541]: No bundle URL present.

    Make sure you're running a packager server or have included a .jsbundle file in your application bundle.
Aug 13 13:37:50 Faolsin-MacBook-Pro SpringBoard[15367]: [KeyboardArbiter] [_UIKeyboardArbiter] Rejecting attach for <_UIKeyboardArbiterHandle: 0x6000002fb180; PID 15535: com.apple.mobilesafari <com.apple.mobilesafari>; hosting PIDs {(
        15541
    )}; level 0.000000; active NO [wants YES]; suppression 0> (currently (null))
Aug 13 13:37:50 Faolains-MacBook-Pro assertiond[15372]: client <BSProcessHandle: 0x7fc551e09a30; MobileSafari:15535; valid: YES> HWM increased to 9 because of <BKProcessAssertion: 0x7fc551d07f40; "systemAnimationFence" (finishTask:180s); id:…0D048429746C>

When simply running on Xcode itself I see

screen shot 2017-08-13 at 1 54 28 pm
alinz commented 7 years ago

can you also add this

Faolain commented 7 years ago

Just added. Build on Xcode still succeeds(Also Cleaning before just in case). However now when I try to run

react-native run-ios

I get the following in my terminal which prevents the ios simulator from opening up now.

screen shot 2017-08-13 at 4 13 39 pm

Update: I was previously on "react-native": "0.42.3" now I upgraded to "react-native": "^0.47.1" because of https://github.com/facebook/react-native/issues/10401 and now the build fails.

Error from Terminal:

screen shot 2017-08-13 at 4 43 05 pm

and when I try to build on Xcode

screen shot 2017-08-13 at 4 44 04 pm

Update 2: I found this https://github.com/facebook/react-native/issues/14935#issuecomment-314160539 which shows that

../node_modules/react-native/packager/react-native-xcode.sh should be changed to ../node_modules/react-native/scripts/react-native-xcode.sh

which I did however the build is now still failing because of the same React/RCTShadowView+Layout.h file not found issue

Faolain commented 7 years ago

Update: Not sure what I did but it works now. The only difference was that instead of just adding the selected libraries you have listed I added everything except *.tvos files. For anyone who is having trouble thats what did it for me. Thanks so much alinz!