evernote-cloud-sdk-ios icon indicating copy to clipboard operation
evernote-cloud-sdk-ios copied to clipboard

Evernote SDK in an extension framework

Open agiletortoise opened this issue 7 years ago • 6 comments

The SDK is currently not well behaved when residing in framework which is set to only "allow app extension API only".

Are their build flags to make this build in an extension friendly manner or any plans to better support this use? It seems the main problem are authentication-specific calls using UIApplication.sharedApplication.

agiletortoise avatar Dec 29 '17 21:12 agiletortoise

So you are saying that if you build an extension app, you can’t use the SDK? Can you make a sample project? Happy holidays.

imougy avatar Dec 29 '17 22:12 imougy

I'm referring to the fact that for a framework to be able to be included in an extension target, it must comply with the limited APIs available in extensions (per the checkbox shown in Xcode).

The main problem call is the [[UIApplication sharedApplication] openURL], which is not allowed in an extension.

It would be nice if there was a way to segment the SDK and include it in a framework safe version, with the authentication pieces that need that method separated do they could be included separately in the parent app.

You can test this by including the Cocoapod in a framework target with this checkbox checked.

drafts xcodeproj 2018-01-09 15-18-37

agiletortoise avatar Jan 09 '18 21:01 agiletortoise

I see. I will take care of it.

imougy avatar Jan 09 '18 21:01 imougy

@agiletortoise, I looked further into it. We can make the extension compile but as you know, openURL only works for Today's extension, no other extension can use openURL. If this is the case, I am wondering if it is best to create your own app, link Evernote SDK to it and then make your extension. What kind of extension are you working on? We can talk about it on the side if you wish. Thanks,

imougy avatar Feb 23 '18 23:02 imougy

Thanks for taking a look. I'm the developer of Drafts (http://agiletortoise.com/drafts), a popular automation app on iOS. I've been updating the app with a lot more flexibility. Ultimately, I would prefer just to do my own integration directly with a REST API because I have my own OAuth layer, etc., but Evernote doesn't seem to offer a straight-forward direct REST/JSON type API. Maybe I'm missing it, but all the thrift overhead seem to make it prohibitive to integrate without using one of the SDKs and doing so does not seem to be supported or documented.

The new Drafts is architected in cross-platform frameworks, and if I continue to support Evernote, there's no clear path to do it for me. My OAuth tier works fine with the Evernote OAuth endpoints. Short of a direct API without all the overhead, I'm not sure what I can integrate that will work in frameworks across iOS and Mac.

It looks like this SDK could be abstracted into two parts - (1) a cross-platform integration piece which handled the Evernote note integration calls, and (2) a helper to make authentication on iOS easier. The later could optionally be used only if needed in the main app bundle. (1) could be init'd with an OAuth token from (2) or obtained directly. I haven't had the time/resources to try to fork it and see if that assessment makes sense – it does, I think (1) could be a Mac/iOS SDK, since the other Mac SDK offering is abandoned, best I can tell.

Any thoughts? Am I crazy or is this doable?

agiletortoise avatar Feb 24 '18 03:02 agiletortoise

@agiletortoise, sorry for the delay. So it seems you don't want - (void)authenticateWithViewController:(UIViewController *)viewController in ENOAuthAuthenticator but instead, you want something like -(void) authenticateWithData:(NSData*):dataFromOAuth). Where the dataFromOAuth is the return from your own authentication endpoints. Correct?

imougy avatar Feb 28 '18 01:02 imougy