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

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?

Related

iOS Google drive "Send a copy" not showing app extension

I have setup NSExtensionActivationRule for audio, video, pdf and so on. I am able to see my app extension in photo app, files app and safari browser. but in case of Google drive, if i choose "Send a copy" , my app extension is not shown in that for the file types mentioned above. Can I know what activation rule can make my app visible in google drive as well?
Although it is an experience-based talk, instead of defining conditions that can be shared by plist, it is necessary to define sharing conditions in detail
The explanation is also written in Apple's official document below.
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/AppExtensionKeys.html#//apple_ref/doc/uid/TP40014212-SW36
You can create a custom subquery as described in the document below.
https://developer.apple.com/jp/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html
Try it with subquery.
It is troublesome to create once. You can do something. When trying with "TRUEPREDICATE", the application which is not displayed is displayed. If you use this to change to subquery's method, it should be displayed!
(It seems that this setting can not be used at the time of release, so it is necessary to change it when creating subquery)
Even when changing the search keyword to subquery, it remained in StackOverFlow.
Question about subquery
iOS Share Extension with custom SUBQUERY for NSExtensionActivationRule
Knowledge of predicate grammar is necessary to create subquery.
It is embarrassing what I made. This solved it.

Is Share Extension appropriate for my case?

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.

Quickly browse localized app store descriptions in other languages and/or countries?

As I am writing and translating localized app store descriptions for my app, I thought it would be handy to read other same-category apps' localized descriptions. However this has become more complicated than I had hoped (e.g., don't really want to change my Mac's language setting on top of my iTunes store country preference). Plus I have had limited success doing this on with OS X and iOS.
Can someone suggest a quick and easy way to look at app store descriptions in another language? I am sure I am missing something obvious here, for example currently I am poking around App Annie to see if it has archived localized descriptions.
Yes, there is a solution. You can use the urls that Apple provides and read the app description from there:
Head over to http://linkmaker.itunes.apple.com/ and you will see that there you can select a country.
For example, searching for "Twitter" in iOS apps and US you get (after removing the trailing url garbage):
https://itunes.apple.com/us/app/twitter/id333903271?mt=8
Now just change the country code. E.g., German and Italian:
https://itunes.apple.com/de/app/twitter/id333903271?mt=8
https://itunes.apple.com/it/app/twitter/id333903271?mt=8
The best way is to modify URL and view it in browser.
If you open an app using URL:
itunes.apple.com/app/APP_NAME/ID
(for example: https://itunes.apple.com/app/zuko-monsters/id545619234?mt=8)
you can just add country code after first part:
itunes.apple.com/de/app/APP_NAME/ID
itunes.apple.com/us/app/APP_NAME/ID
(for example: https://itunes.apple.com/de/app/zuko-monsters/id545619234?mt=8)

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!

How to add icons and more text inside Settings.bundle. Get more options

I am learning iOS development and I have some questions to ask you in my first post.
To learn iOS I do an stupid application which have Settings.bundle. I want to put small images or icons inside it but I can't.
I also write to the right of the PSChildPaneSpecifier the value of a PSToggleSwitchSpecifier
Apple does it, see the image:
I search in NSUserDefaults Class Reference but I didn't find anything about this. Maybe it is impossible and only Apple can do.
You're right, it's something only Apple can do. Third-party apps are limited in what they can achieve in the settings bundle. The only icon you can have is the app icon on the first page, and the only information on the right hand side will be string values - see here for details.
Without being jailbroken you cannot achieve this, Apple simply won't allow it and does not offer a way to do this.

Resources