Is Share Extension appropriate for my case? - ios

I must do the following:
a user chooses a photo using the share functionality in the Photos app;
just like, eg., WhatsApp, the photo "reaches" the app;
the app does something with the photo;
The photo must NOT be uploaded instantly: it must receive the photo and store it (then, IF the user wants, he can upload the photo).
I was thinking to use Share Extensions when I red the following:
Make sure that the Share extension point is appropriate for your purpose. The best Share extensions make it easy for users to share content with websites. If you want to create an extension that lets users perform a different task with their content or that gives users updates on information they care about, the Share extension point is not the right choice.
(source: https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Share.html#//apple_ref/doc/uid/TP40014214-CH12-SW1)
Problem is, now, I don't know anymore if Share Extensions can do what I need to do. Moreover, any online tutorial (and the original docs too) talks about a Share Extension Template that must have been removed from XCode 8.1 (I see everywhere screenshots of a template I can't use).

The Share Extension was what I needed: it's absolutely up to you what to do with the file you are sharing. That is: you can freely create an App Group and store it to send it at a later time, no need for an instant upload. Moreover, you can change the appearance of the controls and perform validation of your content. So, in a smaller number of cases, share extension can be used with a slightly different purpose than intended.

Related

How do I export text from iOS Notes app to my app?

I know this is possible and is something many big apps do, but I can't figure out among UTIs, extensions, UIActivityTypes, etc. which spell I need to use for this in particular. I'm trying to add my app to the list of apps that appear when you hit the export button in the Notes app on iOS because I want to be able to take a bunch of text inside a note and repeatedly and safely send it into my app.
I want my app to appear in this list, exporting directly from Notes. There appear to be duplicates of this question that are very old claiming that "exporting from Notes app is not possible for third party apps", but I think they're either now wrong or answering a different question because as you can see in the above screenshot, Messenger is plainly able to do this.
It does not look like registering UTIs gets this done for me. I went ahead and registered my app to all sorts of UTIs, but all that happens is my app ends up in popups like this one, which appears when trying to open a txt file, which is not what I'm looking for. Unless there is some other UTI that does not conform to public.data or public.content which I need to be using, in which case I'd be happy to hear it.
I used one of my allotted support requests to ask Apple, and after some time and back and forth I was able to get my answer! Here is what they said:
Your project is missing a Share app extension. Start by reviewing the
App Extension Programming Guide:
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/index.html#//apple_ref/doc/uid/TP40014214-CH20-SW1
Information specific to the Share extension point:
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Share.html#//apple_ref/doc/uid/TP40014214-CH12-SW1
You don’t need to register the text content type in your
CFBundleDocumentTypes. as you’ve done in your sample. However, you
will need to provide an activation rule for the extension point, such
as the one shown in this section of the document (the section titled
Declaring Supported Data Types for a Share or Action Extension):
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW1
See specifically the predicate example that activates the extension if
an attachment with the com.adobe.pdf UTI is present. You will need to
do something similar, to cover the UTIs for content you would like
your share extension to consume. As a starting point, you can consume
text with the public.text UTI. For more common UTIs, please see this
document:
https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259-SW1
I also found the bits about providing an activation rule to be super confusing, and this answer helped that: How do I set NSExtensionActivationRule predicates?

Rails - Dynamic vs static application for an e-learning platform

I am about to start developing an e-learning platform where users will be able to watch educational videos for school curriculums and take quizes and so on. The part im not sure about is how exactly should i go about creating each course on the website. Should I create it as a static page where all the content is added manually through code for each course and each video, or should i make it as a CMS whereby each video for each course is uploaded through an upload form and then displayed (using paperclip for example)? Can someone explain to me which is the best approach and why? Baring in mind that video uploading will not be on the user's part, only I will be uploading and adding content to the website.
You should go the CMS way, because it will make your life easier. By generating a lot of static pages, you will see that there are things you want to reuse at another point and then you have to code them another time. With a CMS you can predefine objects like a survey or video content, so that the admin or course leader can use these things in a more efficient way. Mostly, admins aren't techies, so they would be thankful for such a CMS.
This is also important for the following development. Let me give you an example:
You created hundrets of surveys, but then somebody discovers a bug. You need to change your code in too much places. While generating only one model of a survey means also only one fix.

Should I use Share Extension of Action Extension?

I've create a share extension for iOS that allows sharing files from safari, mail, drive, box & dropbox into my app. However I've discovered action extensions and now I'm thinking I might of been better off using them. Are share extensions meant to be for sharing to social networks etc? Should I be using an action extension for this use case?
Share extensions are suitable when there is no need to edit the content or return a result to the app, kinda of like an one-way traffic. It need not be for social networks.
Action extensions are more appropriate when the contents need to be edited, processed, transformed etc and returned to the app.
For your use case, a share extension is the more suitable choice.

Where do Instagram/Facebook store images internally?

Like the title says. In an iPhone, in what directory do Instagram/Facebook (and similar applications) store the images they downloaded at runtime?
When is that directory wiped?
For non permanent images (e.g. post thumbnails but not user profile pics) I would imagine they get stored in the <Application_Home>/Library/Caches, other content probably goes in Documents
You don't need to know what facebook or instagram do, but If I understand your question right, you want to download images asynchronously from web and cache them. For that u can use a third party class to handle the caching instead of writing your own, I would suggest SDWebImage.

Is it possible to load interactive elements into an iOS app?

Does anyone have any ideas how I could package an external interactive slide that could be dynamically loaded by an iOS app? Is it at all possible?
e.g. Imagine having a presentation app on an iPad. There is a set of interactive slides held on the web somewhere, let's say they contain draggable elements.
Can I load one of these slide objects into the app and interact with it? If so, what format would the slide object be?
Thanks,
Mark
Technically it's possible to dynamically load bundles (NSBundle) components in an app. These bundles could even contain executable code, though AppStore guidelines prohibit use of dynamically loaded NSBundles in this way for security reasons.
Additionally you could just use a UIWebView to display some 'slides' on a webpage, though it will be very hard to make the app behave as if it's the same as the native slides - perhaps even impossible (due to how rendering of webpages work compared to native controls, for example).
Ok so lets say you have these "external interactive slides" on a web server somehow. Since you are not saying they are of a certain type (like powerpoint or such) I will just assume that these slides are of some rare format that is probably not supported by any existing apps or the Safari browser.
Then the answer to your question would be: Write your own iOS-app that can read, present and edit these slides. What format are they? Well it doesn't matter. Write an app that can download the slide data from the data and parse it, and present it on the phone.
Then let the user interact with it, and perhaps make the app upload the changes to the server.
You can do anything you like in your app, there are no limits. You just have to write the code for it. If there was some kind of standardised format, lets say you wanted your app to show powerpoint presentations, then you would have 3 choices. Use someone else´s app, or write your own app with a parser for the powerpoint files or make your own app that use some code that someone else wrote to do it (a third part library that you include in your app)
In your specific case, I can not tell if there are any third part librarys to interact with your slides, but my guess is that you will need to do most of it on your own. You could start with looking at how the web services that interact with the slides online works, and if you can interact with them from an iOS-app that you make yourself.
There is nothing stopping you from creating an app, read the slide data into the app, present it in any way you like, let the user change it, save it in your app, or upload the changes to a server. It's all up to you =)
Good luck!

Resources