-
Notifications
You must be signed in to change notification settings - Fork 83
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 Error - You have to be logged in.... #3
Comments
The code is not setting or keeping a value for self.userDefaults for the key "loggedIn" [self.userDefaults setBool:value forKey:@"loggedIn"]; |
I hardcoded the value as true as isLoggedIn does not return as True
|
Nothing is being shared: [OpenWithPlugin.m][onResume] |
I have pretty much the same behavior. Share opens up my app to receive the share but I get the same messages as @kyleamadio |
I had to move the Entitlement file. Check if it's has the App Groups in yours. If not look for another copy of the file as I had one at the root of the hierarchy and one in the Resource folder. I now have sharing working on IOS. If you need more help contact me again and I'll share my set up. |
@kyleamadio interesting... I have two entitlements files:
And they are both essentially empty...and don't contain anything looking like the app group. e.g. the "release" one is:
Any further details/suggestions much appreciated! |
@kyleamadio Awesome! Thank you for this. I manually edited the entitlements files and it appears to be working now, at least in the simulator. Odd that the plugin didn't update those entitlements automatically. The original plugin this is forked from (https://github.com/j3k0/cordova-plugin-openwith) makes a cryptic comment about entitlements ("Build, XCode might complain about a few things to setup that it will fix for you (creation entitlements files, etc)."), and I did experience Xcode offering to fix some things but not until after I made your edits to the entitlements files. Still, it seems to be working, at least on a test app! It doesn't seem to be working yet in an installed app on a physical device but I am sure that is my mistake and I'll sort that out I expect. Thank you so much for the help! |
I am able to get this working on a sample app when run from Xcode. however when I run it from the Ionic command line, it doesn't work - it gets the same "nothing to share" message. I'm guessing somehow ionic isn't putting the entitlements onto the device, or isn't building the share extension target or something. Continuing to investigate but any insight appreciated! |
@viking2917 I don’t use Ionic, just straight Cordova (hard core, hehehe). Any way I used Xcode to figure out the issue as the command line was not helping... and then I build via the command line. |
:) My only real worry about the command line not working, is if the problem might resurface when I release a production app; hopefully that process will work. I'll post an update when I strike bottom on it. Thanks so much for the help! |
Fairly sure it will be ok. You can test that by running the app on the device from the command line too. cordova run ios |
that's my point - when I do that (except I do 'ionic cordova run ios'), the sharing doesn't work. but it does when I run from Xcode. |
You may need to copy those entitlements files to another location for the command line to see them. |
Could you tell me where yours are? I've tried in a few different places and it doesn't seem to help....e.g. what does this say in your project?
|
OK I'll check shortly, out and about |
I just tested using "cordova run ios" and the sharing did not work. Run via Xcode did work. I guess the placement of the entitlement files may be affecting the CLI method of running the app |
I tried placing the files in a few locations could not get it to work via the CLI - only via XCode |
wow @kyleamadio thank you for the extra effort. I also spent most of the day banging my head against this, including redoing all the app provisioning and certs and such in hopes of fixing it (it did not). I also noticed that this plugin creates a target with a different Deployment Target than the base app (my test app was using 11.0/Universal whereas the share extension was 9.0/iPhone. While fixing this did not solve the problem of CLI not working, I do wonder if the share extension will work correctly on iPad unless one changes these to match.... In the meantime, it sounds like your production app works just fine. I'm OK if I can't test Share in the CLI, so long as it works in production - it sounds like your app works fine in prod. Again thanks for all the work. If I can return the favor let me know....I'm pondering merging the code here with the Ionic Native web intent plugin (https://ionicframework.com/docs/native/web-intent/) which only supports only Android. If I can get this working prod-wise, and if I'm successful merging these two apps, it'd be nice to have a single plugin handling "Share" for iOS/Android in a single API. I'll post back here if I do that. |
would be happy to test. Production = running via Xcode, its not approved by Apple yet - That is the next hurdle.... |
good luck! :) |
Hi guys, I hope your things going well. I'm getting that message ("You have to be logged in...."), even after hardcoded to be always true in the OpenWithPlugin.m |
@anthonnyc2 did to do the steps mentioned above related to the entitlements file? (and also see the note above about xCode offering to "fix" things for you, did you get that?). Also in Xcode, do you have two build targets? (one for your app, one for the share extension?), and do they have the same build target? Also for some period of time I could not get sharing to work when I ran from the command line but could when running from Xcode. I fixed that eventually but don't remember what it was I did that fixed it... In Xcode, under Capabilities, do you have both build targets assigned to the same App Group? In Xcode, I had to manually add the cocoapods lib, libPods-Bookship.a, under the share extension build target's build phases rule and I'm fairly sure I had to add/remove the ios platform once or twice, (and then make sure to redo the xcode changes). Sorry - shooting in the dark here, these are just some things I stumbled over. |
Hi, hope someone can help me. I'm getting the Error:
I've manage to track it down to one thing, every time I add the But for what I can see, when the app starts, it is not executing the 'init(), handler()' functions or any other. So when I share some 'URL', nothing happens, it just opens the app. If tried everything for hours, and it only happens when I add the group. Hope someone can help, really need this to work. Thanks! |
I don't have any real insight into your error, but since it mentions the code signing entitlements, I would double check your developer.apple.com app ID setup, make sure your you have app groups enabled on your main app ID. I also have a separate app id for my extension but honestly I can't remember if I needed that, or just created it when I was trying to get all this working. From the installation docs, I would double check the below:
|
Hi Viking, if check my App Id tons of times, and already have two app Ids, one fro the app and the other one for the extension. In both the app groups are enable. And the problem is exactly where you are pointing me to double check. When I add the group to the main app, xcode doesn't give me any errors but when I build I get the entitlements error. Thanks for the quick response. |
Do you guys have any workaround on this? I have setup the App groups on both targets. The ShareViewController.h is also configured correctly. When I run this using cordova run ios --target='iPhone-X' (on XCode 9) or cordova run ios --target='iPhone-X' --buildFlag='-UseModernBuildSystem=0' (on XCode 10) my application is displayed inside the sharelist, however it does nothing and there is no intent received (init success is logged on console). Meanwhile, when I try running this on XCode it does not show my application inside the sharelist. Any comment/suggestion is much appreciated, thanks! |
@benja3 so, i went back and looked at my notes for what I did for iOS, and I am seeing that in fact I had to slightly modify this plugin to get it work for me, because I could never get the "logged in" state to register correctly. I think - but am not sure - that I was seeing the same symptom as you. It's been quite some time since I set this up. My app (which is in production and sharing of text between apps works) uses my own fork of this repo. You are welcome to try it out: https://github.com/viking2917/cordova-plugin-openwith-ios. Caveat: I am an idiot about this stuff, I just hacked til it worked. Buyer beware :) |
also @benja3 per notes above in this thread, I don't think I ever got sharing to work when running the app from the ionic CLI. I had to run from inside xCode. |
Hello guys, I have managed to make this work, for iOS 11.1 at least. For iOS 12.0 I am having some issues sharing images. I've used automatic signing for ShareExt target and that made it work for me. Also my product identifier for ShareExt was wrong, sorry about that (it should have .shareextension at its end, my bad). @viking2917 Thanks for the quick response, I'll take a look into this :) |
@viking2917 In addition to this, did you manage to share images for iOS 12? |
@benja3 My use case doesn't involve sharing images, sorry :( |
@viking2917 Thanks for the reponse :) Sorry if my other question does not fall inside this thread, thanks guys! |
for posterity and my own personal memory: I again started having trouble getting the sharing to "trigger". I discovered that the entitlements files don't seem to get uniformly updated with the keys:
whereas platforms/ios/Bookship/Entitlements-Release.plist did not. If I ran in my Debug Scheme/Build, sharing worked. If I ran in "Release" mode it did not work. So I manually edited the Release plist file to include the above, rebuilt and sharing started working again in the "Release" build". Adding/removing the plugin does not seem to address this issue, I think there's something not-quite-right in the plugin code that alters the plist file, but I can't quite figure it out. |
The log seems to have all the expected data suggesting the plugin is correctly set up.
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][onReset]
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][pluginInitialize] OK
magicalCordovaIOS[4088:1574349] [CDVTimer][openwithplugin] 0.059009ms
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][onReset]
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][setVerbosity] 0
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][setLogger] OpenWithPlugin72745820
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][setHandler] OpenWithPlugin72745821
magicalCordovaIOS[4088:1574349] THREAD WARNING: ['OpenWithPlugin'] took '9233.975098' ms. Plugin should use a background thread.
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][init]
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][checkForFileToShare]
magicalCordovaIOS[4088:1574349] [User Defaults] Couldn't read values in CFPrefsPlistSource<0x1d010c600> (Domain: group.com.CordovaIOS.magical.shareextension, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][checkForFileToShare] Nothing to share
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][setLoggedIn] 1
magicalCordovaIOS[4088:1574349] 03-05 21:58:30 D openwith: init()
magicalCordovaIOS[4088:1574349] 03-05 21:58:45 D openwith: addHandler()
magicalCordovaIOS[4088:1574349] 03-05 21:58:45 D openwith: initSuccess()
magicalCordovaIOS[4088:1574349] init success!
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][onResume]
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][checkForFileToShare]
magicalCordovaIOS[4088:1574349] [OpenWithPlugin.m][checkForFileToShare] Nothing to share
The text was updated successfully, but these errors were encountered: