Steps to create and edit a plist file in Xcode - ios

I want to add key pair values in plist. I dont know how to add the .plist file in XCode. Simply i want to add these details in .plist file named as "Mobile.plist".
Apple - iPhone,iPod,iPad
Samsung - Galaxy Y, Galaxy R, Galaxy Z
Nokia - Lumina
LG - Lg1 ,Lg2, Lg3
I have tried the steps to create a new Mobile.plist file by using this link,
http://iphoneincubator.com/blog/tutorial/how-to-create-an-iphone-preferences-file. But, i cant get it exactly. When i tried to use the steps from this link, the plist file always empty. I don't know how to add the key, values in plist.
I have created one group named as Settings and add new plist file named as Root.plist. Can you please provide the steps to create .plist file and add key,values in it.

Right click on the folder you want to add it to and choose "New file…"
From the Dialog - create a new Resource file of type Property List:
Give it whatever name you want, the plist extension will be added for you. In this case I've created Root.plist
This will bring up a blank file with columns for Key, Type and Value.
Right click in the file and choose "Add Row"
Choose any of the presented options, you'll be overwriting it anyway.
Now change the Key to "Apple". Right click in the type section, where it currently says String and change it to Array.
Click on the disclosure triangle next to where it says Apple so it faces downwards and then right click in the row and choose "Add Row" This will create a subrow under the Apple key. Repeat this until you have three rows:
Edit the values to the three items that you want
Click on the Disclosure triangle to the left of "Apple" on the top row so it points to the right. Right click on the row and choose "Add Row". This will create a new top level item.
Since you have four top level items, each which contains an array, repeat the above process so that you get the structure you want.
If you want to see the raw plist file, right click on the plist file in the project navigator and choose "Open As | Source Code"
And you'll see the raw file
And to get back to the editor view: right click on the file again and choose "Open As | Property List"

A little update for the newer XCode versions 😬
Right click on the folder you want the file -> New File...
Search for property and choose Property List
Name it whatever you want, e.g. "Products"

Related

How to insert space into a CFBundleDisplayName, IOS

I'm new to IOS and currently I'm working on Localization of Displaying Apps icon.
and I made InfoPlist.strings
and then I put the text for like this in my InfoPlist.strings(MyLanguage) file
"CFBundleDisplayName" = "sometext sometext andlasttext ";
and it literally shows every text, include &#x2007 on iphone emulators home screen.
and of course either
"CFBundleDisplayName" = "sometext sometext andlasttext";
is also not working! could you help me?
This solution works for me before iOS11  consider space as double space.
But from iOS 11 Apple has stopped truncating for longer app names. I thing if app name count is greater then 12 to 14, the spaces will be removed. Otherwise, they'll still exist.
  = 2 spaces
Localizing your app display name is actually a very simple task, so let’s just get right into it.
Set up Localization
First, make sure you set up localization for another language (Note, this is not all that is required to completely localize an app, just the display name). Select your project in the project navigator, go to Localizations, then select a language to localize your display name.
Create a Strings File
Next, you have to create a Strings file that will contain the localized name to be used in your project. Go to File > New > File, select your OS target, go to Resources, and select the Strings file template.
Select the template, enter InfoPlist into the name field, and create the file.
Adding Localized Strings
Once you have created your strings file, open it and select all of the languages you would like to localize for in the inspector. In your base language file, add the following:
/* Localized Bundle Display Name */
"CFBundleDisplayName" = "Your_Localized_Name_In_Native_Language";
Then, enter the same in every other language file, swapping in your translated name in the place of your native name as so:
/* Localized Bundle Display Name */
"CFBundleDisplayName" = "Localized_Name_In_Other_Language";
When you are done, each file should look like the following:
Add Localization Keys to Info.plist
The last thing you have to do is add the necessary keys to your Info.plist file to enable your app to read and swap in your localized display name when appropriate. The first key you will add is the “bundle display name” key, it will look like so:
Bundle display name = $(PRODUCT_NAME)
You also have to add the “application has localized display name” key and set it to yes, which will look like the following:
Application has localized display name = YES
These keys in Info.plist will look like the following:
Thats all there is to it! Your app name will now be displayed in all languages that you localize to.

copy element from one dgn to another dgn

Is there an equivalent command in microstation for the copyclip with basepoint from autocad to copy an element from one dgn to another dgn?
I tried attaching a reference and copying it that way, but then I can not detach that reference.
I get an error message about not being able to detach a model from a managed model.
Well, have you considered using the FF (FILEFENCE) command?
As you can see from the help topic it can be used in batch processing.
In short, you place a fence around the content to be saved to another file and then in the command window:
ff=<path_to_new_dgn>
Then, once you have your file, open the other DGN, and attach this new file as a reference.
Now go into the reference manager and right-click the attachment. Choose Merge to Master
Now the contents will be part of your DGN file.
Select the element(s) you want to copy.
Set a tentative snap point on the basepoint about which you'd like to copy. To set a tentative point, the default key is middle mouse button. If that button is not assigned, see this link.
Menu Bar > Edit > Copy
Open the drawing you'd like to copy into.
Menu Bar > Edit > Paste
Ensure your settings in the "Paste from Clipboard" dialog box are correct (angle, x scale, y scale).
Click where you'd like to paste.

No permission to use getFileById in google spreadsheets

I have following problem.
I have two files:
Source file - https://docs.google.com/spreadsheets/d/15zIdIeYFlca-SQ0ryl89oX_tbGjO_6cipqHkkxog7ho/edit#gid=0
Target file - https://docs.google.com/spreadsheets/d/1gGExeO2x8pqNzTPRvel8p-wwe-BDkdF5c6BFA8j_Py0/edit#gid=0
In the source file there is a script (function is named onEdit triggered with onEdit event). When you change the value of R3 cell (Source File) to other "Advisor" whole row should be copied to target file, but sometimes it works, sometimes not. If you change the value of advisor field once and it works try couple of times more and for sure there will be a problem with permission in a while.
When it's not working I get msg that there is problem with permission of executing function called getFileById, which is used in following line:
var file = DriveApp.getFileById('1gGExeO2x8pqNzTPRvel8p-wwe-BDkdF5c6BFA8j_Py0');
Any ideas what to do to solve the problem and why sometimes it works fine ?
Scripts using a 'simple' trigger can modify the file they are bound to, but cannot access other files because that would require authorization.
See here to learn more about the restrictions on simple triggers.
You can make sure you have all the permissions following the next steps:
Open the script project. At the left, click Project Settings
Select the Show "appsscript.json" manifest file in editor checkbox.
At the left, click Editor <>.
At the left, click the appsscript.json file.
Locate the top-level field labeled oauthScopes. If it's not present, you can add it.
The oauthScopes field specifies an array of strings. To set the scopes your project
uses, replace the contents of this array with the scopes you want it to use. For
example:
{"oauthScopes": ["https://www.googleapis.com/auth/spreadsheets.readonly", "https://www.googleapis.com/auth/userinfo.email"], }
Retrieved from: https://developers.google.com/apps-script/concepts/scopes

How to localize my app with Xcode 5?

This is a follow up question (and answer) on the How to localize my app with Xcode 4? question.
How do I localize my app with Xcode 5.x?
It's quite simple once you understand it.
The first thing you want to do is add a localization file to your project.
To do so, simply select your project's main group
,
then, from the toolbar, select File → New → File... (or just hold down ⌘N)
.
Under the Resource category, select Strings File ,
and name it Localizable.strings (note that it is case sensitive) .
Now that we have our localizable file, we can click on the Localize... button, in the File Inspector
.
Xcode is going to ask you if you want to localize the file, just click on Localize with Base selected
.
Now this next part is a bit tricky. We need to enter our project's Info section, to do so, click on the project file in Xcode's Navigator, then to your right you'll see a category named PROJECT, click on your project file under this category
.
Now we can add our desired language under the Localizations category. I'll add Norwegian
.
It's important that we only leave our Localizable.strings file checked in the menu that appears
.
Now we can expand our Localizable.strings file in the Navigator to see our localizable files
.
We now how our Base file (within our Localizable.strings file), which will be our app's "main language", and our previously selected language.
It's important to know that the structure of these files needs to be identical. You'll see what I mean in just a sec.
In our Base, I'll add a string named it_worked, and add it's localization
.
And in our previously selected language (In my case Norwegian), i'll add the same string it_worked (to keep the structure), but with a different localization
.
Now that we have our localized file, we can make our app read it when needed.
I added a UILabel to my app, so that we can make our app display the localized text.
[myLabel setText:NSLocalizedString(#"it_worked", nil)];
Now if I launch my app, we'll see our base language
,
and if I change the language of the simulator to Norwegian, we'll see our other language
.
You don't need to add the uilabel and change the text on code.
You can take advanced of the User Defined Runtime Attributes:
http://cupobjc.blogspot.com.es/2014/04/interfaz-builder-localization.html
First define a new category for UILabel:
#import "UILabel+Localized.h"
#implementation UILabel (Localized)
-(void) setTextLocalized:(NSString *)aText{
[self setText:NSLocalizedString(aText, nil)];
}
#end
Then in the interface builder, User Defined Runtime Attributes :
textLocalized String your string to localized

iOS changing target name

In iOS project, I changed the target name.
But for building, on the top left (beside stop button), its still showing old target name only... What should I change so that old project name will completely disappear from XCode?
Select your target from TARGETS(in left navigation bar) and double click, then rename it.
Just Click on your target Name beside stop button > Manage Schemes > Select and change name
If you want to change Project Name, Target name, -Info.plist name & -Prefix.pch name then,
- Select Project in Xcode (.xcodeproj file)
- Selecte file inspector
- In identity section change project name which u want to update & press enter
- After scanning whole project it will ask to change the file names i.e target, plist & pch file
- Select check boxes as per your need
Target name(TARGET_NAME)
To change a Target name(TARGET_NAME) you can:
Rename a target via Project Settings(Double click or press Return)
Also after changing Target Name you can:
Rename a schema via Manage Schemas... -> Select -> Press Return
Rename a root Group via Navigator. In this case you should resolve errors that can be caused by out-to-date path. For example:
Info.plist(INFOPLIST_FILE) or
Build input file cannot be found: '<some_path>/Info.plist'
Bridging Header(SWIFT_OBJC_BRIDGING_HEADER) or
error opening input file '<some_path>/<module_name>-Bridging-Header.h' (No such file or directory)
Move umbrella header from private to public scope or
Umbrella header '<name>.h' not found
[Xcode components]
To make the change of target name effective you can go to manage schemes and there, remove all old targets. Then click on "Autocreate Schemes Now"

Resources