Xamarin iOS storyboard localization - ios

I'm developing an ios app with xamarin in Visual Studio.
I'm trying to add localization to my Main.storyboard file and to default LaunchScreen.xib file but I can't make it work.
I've follow the documentation here and I've also executed the sample app (which is working fine). I've copied the structure of the project and I've checked files many times but I'm not be able to see my strings localized inside the storyboard or xib files (LaunchScreen.xib).
This is my Info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>MyApp</string>
<key>CFBundleIdentifier</key>
<string>it.company.myapp</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>9.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIMainStoryboardFile~ipad</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>it</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
</array>
</dict>
</plist>
And this is a screenshot of my project structure:
I've seen that storyboard localization ids should be like "kId-c2-rCX". This is true for my LaunchScreen.xib file but not for Main.storyboard file which has simple numerical ids like "192", "193" ecc. Could this be the problem?
What am I missing?

I know this is old question, but I want to tell my solution for problem.
Here is my localization structure:
In my solution i have renamed Main.strings -file to same name that my storyboard.
Now change you ui item localization id to string. In my project that makes the different. Here is image to show what I mean.
Open your storyboard in text mode and replace those id numbers to text.
Now open your Main.strings and type your item there.
More info from: https://developer.xamarin.com/guides/ios/advanced_topics/localization_and_internationalization/

You have to set a default value. For example, you want to localize a textField placeHolder, than hardcode a default value for the placeholder and the localization will work.

Related

App Icon errors using application loader

I am trying to upload a beta of my Xamarin application and I receive the following list of errors when using the application loader:
I created my icons using this and the asset catalog accepted them.
Has anyone had a similar experience or have any insight into this issue?
Thanks!
Using the information from Here I was able to successfully upload my app. To get the Assets.xcassets folder to show up in the solution explorer you can just drag the folder from file explorer into the desired location in the tree. My file names in the contents json file were also incorrect so once those were updated the icons showed up correctly.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>MinimumOSVersion</key>
<string>8.0</string>
<key>CFBundleDisplayName</key>
<string>Contractor App</string>
<key>CFBundleIdentifier</key>
<string>com.company.contractor</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleShortVersionString</key>
<string>1</string>
<key>XSLaunchImageAssets</key>
<string>Assets.xcassets/LaunchImages.launchimage</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconName</key>
<string>icon</string>
<key>CFBundleIconFiles</key>
<array>
<string>icon-20.png</string>
<string>icon-29.png</string>
<string>icon-40.png</string>
<string>icon-58.png</string>
<string>icon-60.png</string>
<string>icon-76.png</string>
<string>icon-80.png</string>
<string>icon-87.png</string>
<string>icon-120.png</string>
<string>icon-152.png</string>
<string>icon-167.png</string>
<string>icon-180.png</string>
<string>icon-1024.png</string>
</array>
</dict>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleName</key>
<string>Contractor App</string>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
</dict>
</plist>
Follow the below,
Right click on Assets.xcassets and select Reveal in Finder.
Take 'Back up' your App Icons from the folder.
From Visual Studio, Delete current AppIcon set in the Assets.xcassets
Add new AppIcon set in the Assets.xcassets
Upload the same required icons according to your app platform type from your back up folder.
Select the new AppIcon set in the info.plist
Try Build, Archive, Sign and upload to TestFlight

The data couldn’t be read because it isn’t in the correct format. error

I got an error,
The data couldn’t be read because it isn’t in the correct format.
Now I am making iPhone app by swift.
I added several codes to Info.plist of my app, I deleted these codes.
But when I wanna open Info.plist of my app, this error happen.I do not know why because I deleted all codes which I added.And I think format is really fixed.
My Info.plist is like
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UILaunchStoryboardName</key>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
How can I fix this?
You've duplicated key in the info.plist file, remove the following key in the beginning
<key>UILaunchStoryboardName</key>
and it will resolve the issue.
Try something below:
Right click on Info.plist -> Source Code -> Discard Change
I was Building flutter project , and the problem was missing <string> for key io.flutter.embedded_views_preview adding <string></string> fixed my issue , i didn't update the info.plist though it was as created by flutter , hope this will help someone using flutter

Open an emailed text file with my swift2 iOS app

I have read this: open text files with my ios app and it's great in the fact that it allows me to see my app as one of the options to open it with and when selecting my app it opens my app but that's it. There are two problems:
First of all, while "opening with" for example Google drive says "Copy to Drive", while mine says "Copy to (null)" when I want it to say "Copy to HotSpotRIS". How can I do this? At least the app icon shows up. If it helps, my overall bundle identifier for my entire project is www.epicode.com.HotSpotRIS. Here are three pictures showing you what I am specifically talking about where the first picture is showing you the emailed txt, second is the user holding down on the txt file, and the third is the "open with" menu that pops up from this with my app reading "Copy to (null)":
Second of all, I know how to read and write text files and how to navigate the iOS file system but how do I connect my code to the .plist file in order to read the emailed txt file? I am guessing there needs to be some identifier that I can then use to call to obtain the txt data. Here is my info.plist file so far with the last bit of the file being the code I got from open text files with my ios app:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleGetInfoString</key>
<string></string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>NSLocationWhenInUseUsage</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>CFBundleDisplayName</key>
<string></string>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Text File</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>txt</string>
<string>TXT</string>
</array>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>www.epicode.com.HotSpotRIS.txt</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.text</string>
</array>
<key>UTTypeDescription</key>
<string>Plain Text Document</string>
<key>UTTypeIdentifier</key>
<string>www.epicode.com.HotSpotRIS.txt</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>txt</string>
<key>public.mime-type</key>
<string>text/plain</string>
</dict>
</dict>
</array>
</dict>
</plist>
Thank you in advance!

Xcode : Submission Failed - Invalid IPA

After many hours of research, I don't know why I can't submit my application from xCode (6.1).
At the end of the submission an error is returned:
ERROR ITMS-90072: "The IPA is invalid It does not include a Payload directory."
The two responses that I've read are located in the info.plist file
Two keys must be added :
- LSRequiresIPhoneOS: YES (Boolean)
- CFBundleInfoDictionaryVersion: 6.0 (String)
The project has been cleaned.
This is the contents of my file info.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>fr_FR</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.forprodis.$(PRODUCT_NAME:rfc1034identifier)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UILaunchStoryboardName</key>
<string>Main</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
I have generated the IPA and unzip it. The folder contains two subfolders :
- Applications
- Symbols
Only the Payload folder should appear, isn't it ? (the wrapper)
Wikipedia describes the content like this :
An IPA has a built-in structure for iTunes and AppStore to recognize,
The example below shows the structure of an IPA:
/Payload/
/Payload/Application.app
/iTunesArtwork
/iTunesMetadata.plist
I just had the very same problem. It turned out that a missing entitlement for in-app purchases was the culprit.
Select your target and go to 'Capabilities'. Xcode highlighted the missing entitlement and offered to fix it. Then it finally worked.
I hope this works for you as well. I have spent the last couple of hours tearing my hair out.
I faced the same problem on an application that I've successfully submitted many times over the past few years. To correct it, I had to edit the Info.plist file to set:
Application requires iPhone environment = YES
Mine was set to NO. This does not restrict the application from deploying to iPad or iPod.

Newsstand Icon doesn't show in Xcode 5 iOS 6.1 SDK

Since upgrading Xcode to v5 and converting launch and app icon images to image asset catalogs, I've been unable to see the Newsstand icon of my app in the Newsstand on iOS 6.1 and iOS 7. Instead I see the regular app icon in its place. I'm still compiling against iOS SDK 6.1 because of obvious style changes in iOS 7 that I haven't been able to test in depth, yet.
That said, here is what I've tried on my Newsstand icon, icon-newsstand.png:
Converting the icon-newsstand.png into an asset catalog located in ./Images.xcassets/icon-newsstand.imageset/icon-newsstand.png.
Keeping icon-newsstand.png in my Resources folder as a part of the project.
Neither of these solutions work. Here is my info.plist for reference also. I've redacted the app names, just FYI.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>---- ----</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIcons</key>
<dict>
<key>UINewsstandIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon-newsstand.png</string>
</array>
<key>UINewsstandBindingEdge</key>
<string>UINewsstandBindingEdgeLeft</string>
<key>UINewsstandBindingType</key>
<string>UINewsstandBindingTypeMagazine</string>
</dict>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>newsstand-content</string>
</array>
<key>UINewsstandApp</key>
<true/>
<key>CFBundleIdentifier</key>
<string>com.----.----</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.1</string>
<key>CFBundleName</key>
<string>---- ----</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.0.1.13830</string> <!-- The Version of the app. -->
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>FB Connect</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fb150871295037449------</string><!-- The app id must be appended to the end of this string. Example: <string>fb150871295037449connections</string> -->
</array>
</dict>
</array>
</dict>
</plist>
Has anyone run into this yet after upgrading Xcode and converting to image asset catalogs? And does anyone have any ideas where to start with changes to my project? So far from my searches, details online and on StackOverflow have been sparse in terms of Newsstand and Xcode 5 issues.
I'd greatly appreciate any help. Thank you!
I found out that the issue was only happening with iPads. Since that discovery, I realized that there was a section missing from my info.plist that looks like this:
<key>CFBundleIcons~ipad</key>
<dict>
<key>UINewsstandIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon-newsstand.png</string>
</array>
<key>UINewsstandBindingEdge</key>
<string>UINewsstandBindingEdgeLeft</string>
<key>UINewsstandBindingType</key>
<string>UINewsstandBindingTypeMagazine</string>
</dict>
</dict>
Mystery solved!

Resources