How can one possibly display an information paragraph within settings.app? I'd use root.plist and NSUserDefaults group footer. But how can I link these two together, so the information can be modified dynamically from the app?
I would like to display information like: #"Your secret user code is: %d", userCode. And change the userCode every time the user e.g. purchases something.
Related
I am an iOS app developer. Right now, I need my app to update his/her scores in the database (Firestore) when a user tabs a button.
I only know that it is possible to add new documents to the database according to the official doc: https://firebase.google.com/docs/firestore/quickstart#swift. But can I simply update one key-value pair within a document at a time?
For example, I have to add 10 points to the user with ID: 1234 if he/she clicks the correct button. So first of all, I need to read the data according to the unique ID, and catch his/her current points. Then put back the points plus 10.
It looks like Firestorage only allows users to upload an entire document once a time.
Swift code snippet is appreciated!
You can update a single or multiple fields in a document with the updateData call.
To atomically increment a numeric value can you can use the FieldValue.increment operation. From that last link comes this example:
washingtonRef.updateData([
"population": FieldValue.increment(Int64(50))
])
This code increments the population field in the document by 50, and leave other fields in the document unmodified.
Right now, I'm generating unique IDs with childByAutoId(), but was wondering if there was a way to do this only generating numbers, no letters or other characters?
The reason is I need to be able to automatically send this key through imessage (part of how I send invites) and when it contains letters you're not able to automatically select and copy the key without copying the entire text message. With numbers only the key will be underlined and selectable.
Is there a way to either generate an ID with numbers only, or to selectively underline part of an iMessage with MFMessage in Swift?
Thanks!
I've need a similar option. When i create a new user; it will have a numberID which will be unique. I've tried .push() method which is for android, creates a uniqueID but with characters(letters) included. What i've done was something like this;
When i add a new user, i increment a value from different branch which is User2Key in this situation. And gave the value as key(parent) of newly added user.
When i delete or update a user, User2Key will be the same. If i add a new user then it will be incremented so every user will have uniqueID.
You can use a similar approach.
Hope this helps! Cheers!
I have an existing Google ad campaign that geotargets a particular region. The destination URL of all the ads and sitelinks have the same query string appended to it ("area=astoria").
I now need to copy this campaign to 50 other campaigns, each of which will target a different region. Each campaign will have a different value for the area key, so for instance one campaign might use "area=manhattan" and another "area=bronx".
The campaign I'm cloning has many ads and sitelinks, all of which need to have the query string changed. I know how to manually change the destination urls, but it's an enormous amount of busy work...
As a workaround, is there a way to automatically append a different query string to all the destination URLs for ads and sitelinks in a particular campaign in Google AdWords?
To answer my own question, the answer is to use a Tracking Template on the Campaign level.
To do this, click into the Campaign you want to edit and click on the Settings tab. Then open the "Campaign URL options (advanced)" section and change the Tracking URL to something like this:
{lpurl}?area=whatever
You can click the TEST button to make sure your ads work. Your sitelinks should also have the same query string appended to it. (Note that a Campaign-level Tracking Template can be overridden at the Adgroup-, Ad-, or Sitelink-level, so those more specific Tracking Templates would have to not be used for a Campaign-level Tracking Template to be used.)
In desktop applications when talking about a config file sometimes it's about letting the end client change some parameters according to his systems - for example entering his system IP or other parameters that can not be hardcoded, and must change by him because the user doesn't want you to know them.
I read about the option to create a settings.plist and reaching the value from NSBundle but how can the end client change the values in it?
You're talking about implementing a settings bundle. Once you've done that, the user will be able to adjust the values in the main iOS Settings app - there will be a section for your app.
There are many Preference control types available. You can use a Text field.
The text field type displays a title (optional) and an editable text field. You can use this type for preferences that require the user to specify a custom string value.
The key for this type is PSTextFieldSpecifier.
To retrieve the edited value at run time, use the below code.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *iPAdress = [defaults objectForKey:#"IP address"];
Once these all done, Go To your iPad default Setting App-> You can view your application name listed under Apps section. Tap on it.
I want to create a acknowledgement section on the settings pane of my app, just like the one that apple created for the Airport Utilities...
I've created a child pane, that links to an acknowledgements.plist already... however, I can't figure out what type they used for writing the actual acknowledgments.
I assume that they use PSGroupSpecifier. http://www.bunnyhero.org/2011/02/14/descriptive-text-in-iphone-settings-bundles/ - this is pretty enough to know.
So, just remove title for group and add footer. All text will be nice formatted as in example.
(Spend over 2h to find any info because my group title was uppercase string)