I have two subscriptions on the same record type List: the first one for the creation of records of type List with a reference to a record A and the second one for the creation of records of type List with a reference to a record B.
I'm using silent notifications with CKFetchNotificationChangesOperation to don't miss an update. The main problem is how to use CKServerChangeToken: should I use two tokens depending on the subscription or is using just one token for all the subscriptions on a record type (in that case List) working?
Related
I am trying to make small POS system, using FDMem table to fill items for the customer.
In case the customer forget his money or go to change a product .. and the customers in the line move and new customer shows up asking to start sale process, how can I save or freeze the current state of the FDMem table holding the products of the previous customer and start a new order and finish the sale. Then, when the first customer comes back, how can I resume the previous sales process and reactivate the previous FDMem table with it's items?
Add one more column in the FDMem table. That column could take 3 values: 'Finalized', 'Opened' and 'Paused' depending how the "status" of the sales is going. You can then navigate between the records.
So if I understand you correctly you want to be able to handle multiple customers or orders at the same time.
One solution one would guess would be to assign each customer unique number and them add that number as additional field to each record in your database. Now assigning unique values to online customers isn't particularly difficult. In fact you already have such information in form of session ID. But doing something like this for customers in a physical store is not feasible.
But there is another similar solution. Most Tax authorities require any shops to issue a receipt for any purchase made. And each of those receipts needs to have a unique number. So you could reserve a new receipt number when customer gets to your POS for the first time and you start adding its items to the system. Then you might want to have another table with all reserved receipt numbers and their current status, so you can know which receipt has been finished which one is still pending completion or which one was cancelled.
My passbooks are user's store cards, they have same certificate (same pass type identification) and category as discuss in this link, but I don't want them to group together since they are for many different stores or business. Any way to do that.
For storecard passes, the only way to prevent grouping is to use a different certificate. coupon, storecard and generic passes with the same passTypeIdentifier will always be grouped together.
For eventTicket and boardingPass types, you can use a groupingIdentifier key to separate passes with the same passTypeIdentifier into different groups.
groupingIdentifier |
string |
Optional for event tickets and boarding passes; otherwise not allowed. Identifier used to group related passes. If a grouping identifier is specified, passes with the same style, pass type identifier, and grouping identifier are displayed as a group. Otherwise, passes are grouped automatically.
Use this to group passes that are tightly related, such as the boarding passes for different connections of the same trip.
Available in iOS 7.0.
PassKit Package Format Reference
I'm building an app that allows users to manage their products in the cloud.
To do this, I have a Product Record type in iCloud. I use this record type for two purposes:
To manage the products I have available, all stored in a dedicated Products record zone
To save products I have stored in checks from customers. I have a separate Checks record zone, in which I save checks or 'receipts' from transactions made with customers. I use the Product record type here too, in order to keep track of what products are being sold.
Now I have one problem: When I try to fetch all products for my product manager, it also fetches the products from the Checks record zone - the zone containing the transactions and the products they contain. I obviously need to fetch only the products from the Products Record Zone.
There doesn't seem to be much reference for this on the internet, so I figured I'd post a question here for, also for future reference.
Is there a way in CloudKit to fetch records from a specific record zone?
You could use a CKQueryOperation and set the zoneID like this:
let operation = CKQueryOperation(query: query)
operation.zoneID = CKRecordZoneID(zoneName: "name", ownerName: "me")
Im sitting with this issue bugging me. I have core data working fine, but when it fetches, in my case, the users, they come back in different orders. Normally would use the standard unique identifier, but core data doesn't have this. So....
Do I manually create an ID entity_property and assign it incrementally, or is the "object id" being made in incremental order; incremented maybe by 1, or just random IDs? hence making me able to use object id.
My goal is to get my fetched array in the same order the users was inserted.
Thanks
You'll need your own technique for generating the unique ID. Run that code in your NSManagedObject subclass's -awakeFromInsert, which is called once, when the object is inserted into the datastore. You can add a timestamp, or the value of an incrementing counter.
There's no built-in support for an autoincrement ID. You'll need a class variable, and increment that yourself in -awakeFromInsert. You'll also have to persist that value across launches, either as its own Entity or within the persistent store's metadata.
You might benefit from using an ordered relationship, if those users have a one-to-many relationship with some other entity.
The NSManagedObjectID is unique within the store, but will change when the NSManagedObjectContext is saved (and the NSMOID goes from temporary to permanent). No promises are made about its sequence or pattern of construction. And it can change during a managed object model migration. So don't depend on it for anything you need to control.
core data does not return ORDERED data. so, if your data is "string" or "date" type then you can simply sort your data by ascending/descending after fetching from code-data.
I want to make a database for an iOS application consisting of groups that can have the same name. I am hosting my database on AWSDynamo.
Since multiple groups can have the same name, I was planning on having a groupID as the hashkey, unless someone can suggest a better method.
My main problem is storing an integer that will be the number of groups. This is so that when a user creates a new group the number will be incremented and the new group will get that number as its groupID.
How can I store an integer in such a fashion that all users can access it from the app?
UUID – Universally unique identifier
You can use a UUID (String) as your groupID in your groups table, and use conditional writes (PutItem, UpdateItem) to handle the extremely rare case where there is a collision. If you create a UUID for a new group where the UUID already is assigned to another group, you will get a ConditionalCheckFailedException so you can retry with a new UUID. You don't need to use an incrementing sequence to uniquely identify groups.