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

Error when sharing image to Instagram (iOS) #117

Open
pjamourik opened this issue Dec 1, 2020 · 15 comments
Open

Error when sharing image to Instagram (iOS) #117

pjamourik opened this issue Dec 1, 2020 · 15 comments

Comments

@pjamourik
Copy link

Is anyone else experiencing problems when sharing images to Instagram.

The problem only occurs on iOS, and only started about 1 or 2 weeks ago. Android works fine.

After selecting Instgram:

Schermafbeelding 2020-12-01 om 10 52 17

Coming back to my app, following error from the plugin shows:

Schermafbeelding 2020-12-01 om 10 53 24

Any feedback would be highly appreciated

@atans2468
Copy link

atans2468 commented Dec 10, 2020

I am having this issue as well, any update on resolution? I noticed that everything seems fine in iOS 14.0.1 but getting this error after updating to iOS 14.2

@rodrigograca31
Copy link
Collaborator

Has Apple released a new version of iOS!? Is that the latest version of iOS?
I'm not an iOS user or dev... cant help much but that might be a problem....

@atans2468
Copy link

@rodrigograca31 yes it seems that they released iOS 14.2 and I'm no longer able to post due to this error when using this version. I can confirm that posting using version 14.0.1 is working though. I'm not an iOS dev either... @pjamourik did you find a work around for this?

@pjamourik
Copy link
Author

Not really. I temporarily disabled the plug-in for iOS only.

I just download the image to the phone's library, copy the text to the clipboard and then open Instagram. The user then can select the image manually. Not great, but it works.

@ensemblebd
Copy link
Contributor

ensemblebd commented Mar 17, 2021

Same, occurs on iPhone 11 @ > 14.0 < 14.4.1
14.4.1 works fine (iPhone 12).

Will reply if I find alternative or details of value. But so far it's a dead end.

Am reviewing this and this, and xcode logs to hopefully identify issue.

@ensemblebd
Copy link
Contributor

ensemblebd commented Mar 23, 2021

I've found that different versions of IOS 14+ yield different results.
On latest ios for me anyway, the document intent UTI system works perfectly well. Though having to find instagram in the list of apps is a pain.

But I have an alternative solution for the failing ios version. Am in progress working up a pull request after I clean it up and test more...
I'm changing the code to give cordova's javascript a param (you) - the ability to control which approach to use. Instead of using ios version detection.
That way if one fails, you can have your code call the other at will.

  1. Approach 1 (old logic: < 13.0) -- Use igo extension and Document Controller UTI of ".excusivegram"
  2. Approach 2 (old logic: >= 13.0) -- Use ig extension and Document Controller UTI of ".photo"
  3. Approach 3 (new) -- save base64 to Library, then launch app intent of instagram://library

The only solution I could come to, was to save the image as jpg to the Library, so as to generate a local identifier by scanning PHAsset, then launching /library intent. It works flawlessly on the failing ios version.

The only downsides:

  • it requires library access.
  • potentially it resaves (duplicate) the same photo you picked from library in your standard cordova getPicture event.

So if you have a proprietary solution already in place for your app, to attain localIdentifiers from library, then you should just switch to the shareAsset function and call it a day. Otherwise, stay tuned for my git commit to feed base64 into library into instagram, as it were.

ensemblebd added a commit to ensemblebd/InstagramPlugin that referenced this issue Mar 23, 2021
…identifier, to be then opened by IG.

This was to bypass Document Interaction API approach, which is clearly not working on some IOS 14+ devices for specific Instagram versions.

Further notes:
The error messages in terminal from xcode do not indicate any reason why DI would fail. And on latest 14.4.1 of IOS with latest instagram, the code which is broken works fine.
I believe it's caused by instagram itself failing to process the "Copy to" DI event, since the error is resolved on latest.

Therefore this commit simply introduces developer control to specific precisely which "logic mode" (approach) to use.
You can use legacy... IGO (exclusivegram), or 13+  IG (photo), and now --- LIBRARY mode which works as described above.
DEFAULT Mode is ... the default. And so existing user code will be left unaffected by this change. It will continue as if no change was made.
User can opt-in to use the new logistics, if they so choose.

REF: vstirbu#117
@ensemblebd
Copy link
Contributor

ensemblebd commented Mar 23, 2021

if you wish to use it without pull request being processed, you can.
But is at your own risk, it's working great for me, but recommend thoroughly reviewing the Objective C code to ensure it meets your own standards and is bug free to your view.

cordova plugin add https://github.com/ensemblebd/InstagramPlugin#5581fa220beda5071898ead5bc8e4d5423fa0b4b
or
meteor add cordova:cordova-instagram-plugin@https://github.com/ensemblebd/InstagramPlugin.git#5581fa220beda5071898ead5bc8e4d5423fa0b4b

@rodrigograca31
Copy link
Collaborator

I just merged this and release as 0.6.2.
Hopefully solves the problem.

@swetanagur-salesfloor
Copy link

swetanagur-salesfloor commented May 4, 2023

I am still facing above issue on IOS 16, getting the above error when trying to post/message on Instagram
Screen Shot 2023-05-02 at 10 54 58 AM

Here are the errors, that I traced from mac console, generated while recreating the above issue

Screen Shot 2023-05-04 at 10 25 57 AM

Screen Shot 2023-05-04 at 11 32 19 AM

Screen Shot 2023-05-04 at 11 34 17 AM

@ensemblebd
Copy link
Contributor

ensemblebd commented May 4, 2023

Interesting. Looking online am seeing other reports listing it as a bug with apple (here, here).
But has been a year since activity on the topic, so in theory apple has resolved it. The underlying case number was deleted by apple staff, so can't check (FB9793368).

Grep scanning for NSObject, am not seeing any in the core code of this plugin.
Are you able to post which version of cordova you have that it's compiling under? Also Gradle?

I'm using a Meteor project, so my cordova/gradle is always several versions behind everyone else.
But for me it's not producing this issue; here's my version info for comparison:

  • IOS: 12.5 (monterrey) , on a M1 chipset
  • XCode: 13.4.1
  • Cordova: 6.2.0
  • Gradle: 7.1

@swetanagur-salesfloor
Copy link

swetanagur-salesfloor commented May 4, 2023

IOS: 16.4
cordova-ios: 6.2.0
cordova:11.1.0

@ensemblebd
Copy link
Contributor

ensemblebd commented May 4, 2023

Just updated my IOS to 13.3.1, and XCode to 14.3, but same Cordova as you (no change).
For my mac-mini that's the highest I can upgrade to unfortunately, so I can't match your 16.
Tested functional for my device: IPhone 12 and 13, with latest version of Instagram installed.

How does your config look? Like the callee that is.
Mine is as such:

let base64='data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QBg...';
let caption = 'captions no longer functional per instagram change; this does nothing';
let callback = (err) => {console.error(err);};

let mode = window.Instagram.SHARE_MODES.LIBRARY;
if (window.device && window.device.version) {
	var parts = window.device.version.split('.');
	let major = parts[0];
	if (major < 13) {
		mode = window.Instagram.SHARE_MODES.DEFAULT;
	}
}

window.Instagram.share(base64, caption, cb, mode);

(device is via: https://www.npmjs.com/package/cordova-plugin-device)

Also, check for any plugin logs in XCode developer tools.
The plugin has it's own error log output.
Very first thing you should see when the cordova plugin executes, via IsInstalled() self check, is: "IOS Version: 1.2.3"
Followed by: "open in instagram", then "Using DEFAULT logic mode" if not specifying the Mode parameter above, and then by: "Saving temporary file under app specific folder", and then several different types of log outputs based on the Mode determined.

ie. If none of those messages are present, then the plugin isn't even executing; so something would have to be broken at a core level.

I'll look around and see if I can spot any reason why you'd get that error, but so far I can't replicate.
Sorry not an easy answer yet.

@swetanagur-salesfloor
Copy link

The issue exists only for ios 16 and higher versions, I tried with ios 13 and ios 12 I cannot reproduce it

@rodrigograca31
Copy link
Collaborator

I dont have have iOS devices, if someone comes up with a solution and sends a PR I can accept it tho

@ensemblebd
Copy link
Contributor

ensemblebd commented May 12, 2023

Same here, and unfortunately I can't afford a 2022+ mac right now, so am hardware locked by Apple.
Trying to find a way to get my hands on one, something in the cloud maybe for rental fee.

My coworker has ios 16.5 on his phone, and compilation from lower mac with xcode deployed live on appstore is working fully.
So I believe this issue is related to the compilation in xcode (and not necessarily the ios phone it's deployed to).

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

5 participants