NSUserActivity and CoreSpotlight at the same time - ios

I'm planning to use both NSUserActivity and CoreSpotlight on my app at the same time, but somehow I can't make it work as I intended.
I'm currently working in a retailer online shop.
The following steps would be required:
Step 1. Every product the user visited in my iPhone app, will get identified by a NSUserActivity object which will be shown in Search API. Also, it's public and has a thumbnail image, title, description and expiry date.
Step 2. The user searches on the iPhone Search and the product does appear there. It will be also displayed within the app if the user taps on it. All easily achievable so far.
Step 3. The user has the right to 'save' that product, so nobody else can get it before he does. So, once the product is saved, I would like to modify the details of the NSUserActivity so it can show on the description the product is saved. As far as I know I can't do that, as there is no API to do that.
Ideally, I would like to modify the description and the image, to let the user know that product belongs to him now, so I would make the NSUserActivity private and I would modify its properties, but I can't find a way.
On the other hand, I could use NSUserActivity to handle the public products and CoreSpotlight the saved ones, but in that scenario, the app would display twice the same product. One that is the saved and private, and the one that is public. Something I would like to avoid, as I want you to see only once the same product, in this case, the one you have saved and is yours.
Is there any way I can achieve that?

It's pretty easy to prevent item duplication. All you need to do is specifying the same value in relatedUniqueIdentifier (NSUserActivity) and uniqueIdentifier (CSSearchableItem).
This will also increase your ranking.
See the documentation for details.

Related

Podio: Can I set a reminder on a date field through the API/SDK?

I've got an app in Podio that represents Meetings. One of the fields is time/date and it allows a reminder to be set for that time/date (much like you can with tasks).
I've also got an iOS app that can create Meeting items and I was hoping there was a way to programatically create a reminder when the item is created (or that a workflow could be created to handle it) but it doesn't seem to be possible. The Reminders API only works for tasks, according to the documentation, and there doesn't seem to be another way to do this?
It might be missing in documentation, but reminders should also work for items.
Please try to create one using details from here: https://developers.podio.com/doc/reminders/create-or-update-reminder-3315055 and use item as ref_type and your item id as ref_id

How do I update my iOS app's content with background downloading?

TL;DR: I want to add images to the app over the internet through background downloading of some sort, but don't know where to start, or what the best method is.
My app displays images to the users which can be filtered etc. I have a "Cards" class that has fields for name, image, etc. I then have a huge area directly in my code where I create instances of the Cards class for each image. There is then an array of these class instances, which helps with displaying them.
My issue is that now I want to be able to update this block of class instances without having to push another build to the iTunes store. Essentially, I want to add "Cards" to the app (images with appropriate names and keywords associated with them). I need to be able to update the app every month (sometimes less) with new cards as quickly as possible.
I have heard suggestions here and there about JSON files and background downloading, but can't figure out which method I need for my situation.
As per my understanding you just want to update your app content in future without uploading a new build to App Store. Right ?
If you want to do so, make your app so flexible that you can show updated contents in your app.
Here is a short instruction which you can follow...
Develop an admin panel if you are aware of any backend scripting language like php. And you can add contents from this panel into your database.
Create an API which will fetch the content from your database
Make your app flexible so that it can show all the updated content getting from the API. If you have a list of content then you can use TableView/CollectionView with pagination.
If you still face any problem then let me know. I will see deep into your problem.

How to get user's age category inside an iOS app?

The Apple App Store has some fairly strict requirements on what content an app can display and still meet the age ratings. I'd like to add a feature that can display content created by any 3rd party which means that, though "adult content" is not appropriate, it's not possible to guarantee that some spammer or vulgar person doesn't post inappropriate things.
I'm considering blocking access to that particular feature of the program for younger users.
How can an iOS app determine the age "category" of its user in order to choose what features to provide?
Other suggestions on how to deal with the issue of un-vetted 3rd party content is also welcome.
Ok so basically you want to know if there is a way to detect the users age and thus display certain features as is appropriate.
Well two ideas come to mind:
IDEA 1
You could try using the built in contacts API to see which contact the user has set themself as. If they have one, then check if it has a birth date. And thus figure out their age.
IDEA 2
Ask the user to enter their birth date in when they launch the app for the very first time. Then figure out the age and save it in a NSUserDefault. You can then use that value throughout the app to determine what features and posts to show the user.

How can I check if a person has been selected from the Address Book before in iOS?

I am building an app that relies on choosing people from the address book, and adding their information to an NSMutableArray. I only want each person chosen once, so I want the ability to grey out the people who have already been chosen. I am not sure where to look. Can someone point me in the right direction?
You should keep a list of already chosen users. For example, you can save them into CoreData store, SQLite table, plist file, etc. To compare currently selected user with those who are already on the list you'll need some unique identifier for every user. In most cases it's enough to store user's ID on the list, not the whole entity.

in-app purchase best practise: how to use what is downloaded

simple example of the problem:
i have an app that can download backgrounds from in-app purchase.
so i download images (or a zipped image).
now that i have it on my iphone...how can my app knows the name of the image and can load as background of the game?
what i have thought is zip of the image+downloaded.plist;
downloaded.plist is a filename that contains the name of what i have downloaded, so my app loads that plist (i know the name because is always equal) and then the rest...
but now i have to save that information in another local plist that contains all add-on downloaded...
this is a very basic example, but i can in future load levels, character...so i'd like to know how to organize work to have it more general as possible...
what is the standard method to make this?
thanks
I am not quite sure I understood your question, but here are some thoughts.
When the user buys something using iap, you know the associated product id. With that, you can map to the actual thing the user has bought (whether it is an image, a level, cash, whatever). So, you should use the product identifier to know that to give to the user.
It seems you are dealing with non-consumable products here. If you ship your app with the products inside the bundle, you can unlock them using the product id (As you said, you need to maintain a list of the unlocked files). If you need to download the products, the same applies here, you need to use the id to know which file to download.
To organize work, I would implement a store object that deals with the store kit, loads the products according to the transactions made, gives them to the user, maintains all the necessary stuff, etc. You can escale this approach to a set of classes if necessary.
On a side note, for non consumable products, you should perform several things on a server, e.g. maintain the list of products the user bought, validations, etc. You can read about this in the in-app purchases programming guide from Apple.
I hope this answers your question.
Cheers

Resources