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

Crashing on iOS when sharing from specific apps #40

Open
itaibs opened this issue Jun 19, 2017 · 5 comments
Open

Crashing on iOS when sharing from specific apps #40

itaibs opened this issue Jun 19, 2017 · 5 comments

Comments

@itaibs
Copy link
Contributor

itaibs commented Jun 19, 2017

Hi!
First of all, thanks for the amazing package. Super helpful for our project.

I have everything set up and working on both android and iPhone. On android everything works perfectly and same is true for iPhone when sharing from chrome/safari.

But when trying to share from YouTube (and some other apps as well, e.g., notes) the share extension crashes with the next exception (I found on the console logs):

Exception '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]' was thrown while invoking data on target ReactNativeShareExtension with params (
6,
7
)

I have no idea what to do about this. Would appreciate any input :).

Thanks!

@alinz
Copy link
Owner

alinz commented Jun 19, 2017

@itaibs I have built this only for browsers to share links. One thing you can do is put the breaking point here and try to see why it causes that error. I'm going to look into this issue in few days as I progress in my app. if you can solve this I'm more than happy to accept your PR. other than that you have to wait couple of days before I get into this issue.

@itaibs
Copy link
Contributor Author

itaibs commented Jun 19, 2017

@alinz Thanks for the quick reply!

Considering my knowledge of native iOS programming is 0, I don't think I can be much help.
Glad to hear this is already something you plan on doing!

In the meanwhile, do you know how I can prevent the extension of showing up when sharing from unsupported apps?

@alinz
Copy link
Owner

alinz commented Jun 19, 2017

@itaibs one thing you should know that you need to set NSExtensionAttributes in your plist file for your app in order apple accept your app. Maybe you can dig into this and see if you can limit the access of share extension in certain area. You can look into this and search for Declaring Supported Data Types for a Share or Action Extension.

let me know if you find something, it would be nice if you can document it and send a PR to this repo.

@itaibs
Copy link
Contributor Author

itaibs commented Jun 20, 2017

@alinz Thanks for the heads up.
From what you are saying, I conclude (and please correct me if I'm wrong) that the following should be in Info.plist:

<key>NSExtensionAttributes</key>
<dict>
  <key>NSExtensionActivationRule</key>
  <dict>
    <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
    <integer>1</integer>
  </dict>
</dict>

I have done this in my project and indeed the result is that my extension shows when sharing from browsers and doesn't show when sharing from apps like "Notes". YouTube, however, still shows my extension, I'm guessing because it does actually share a url.

So as far as I understand, there's nothing to be done about that for now, correct?

I'd be happy to add this step to the Readme.md if you think this is right (considering this doesn't fully solve the issue).

@alinz
Copy link
Owner

alinz commented Jun 20, 2017

@itaibs yeah, that is correct. until I fix the issue, there is nothing you can do. and Please send me a PR updating doc and referring to this issue or the link to apple with some description and details.

Thank you

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

No branches or pull requests

2 participants