Post not yet marked as solved
I logged in to macOS with my localization language.
try to perform following code. but always get "Documents".
What do I miss?
Apple Swift version 5.2.4
macOS 10.15.6
Xcode 11.6
code
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
if paths.count > 0 {
let doc = FileManager().displayName(atPath: paths[0])
print(doc)
}
result
Documents
I have a full screen list and want to use the new keyboardLayoutGuide constraint, but by default it uses the safe area inset. How can I disable this so my list goes all the way to the bottom of the screen when the keyboard is not shown?
NSLayoutConstraint.activate([
collectionView.topAnchor.constraint(equalTo: view.topAnchor),
collectionView.bottomAnchor.constraint(equalTo: view.keyboardLayoutGuide.topAnchor),
collectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor)
])
Post not yet marked as solved
I am working on an app that pulls data from weatherKit, including the conditionCode property, the content of which is displayed to the user. I wish to localize the data pulled from weatherKit but when pulling data from:
weatherkit.apple.com/api/v1/weather/de/{latitude}/{longitude}
The conditionCode and other strings is in english. Same is true if the language parameter is set to es, ja or something else.
Am I doing something wrong or is localization yet to be supported in weatherKit? I can't find any documentation on this.
Post not yet marked as solved
I write macOS menu app with TextField by SwiftUI on Japanese Input mode. On some conditions, the TextFiled lost focus, no key input, no mouse click. User cannot do anything.
Setup
MacOS Ventura 13.3.1 (a)
Install Japanese Romaji Input source by System Preferences -> Keyboard
Set input mode as "Romaji"
Build test source code
On Xcode 14.3, create new macOS app project "FocusTest" with SwiftUI, Swift.
Replace FocusTestApp.swift with attached code.
Build on Xcode
Steps
Set input mode as "Romaji"
Run FocusTestApp
Click T square icon on top menu
Small windows with globe appear
Click Desktop background area
Click T square icon on top menu
Click PIN
T with PIN textField View appear
That textField lost focus, click inside of textField
Key or click is not accepted.
With US keyboard mode, key input become possible on Step 10. But Focused blue square is missing.
Code of FocusTestApp.swift
import SwiftUI
@main
struct focusTestApp: App {
var body: some Scene {
MenuBarExtra("Test", systemImage: "t.square") {
MainView()
}.menuBarExtraStyle(.window)
}
}
struct MainView: View {
@State private var showingPIN: Bool = false
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Button("PIN") {
print("clicked")
showingPIN = true
}
}
.padding()
.sheet(isPresented: $showingPIN) {
PinView()
}
}
}
struct PinView: View {
@Environment(\.presentationMode) var presentationMode
@State private var pin: String = ""
@FocusState private var pinIsFocused: Bool
var body: some View {
VStack {
Image(systemName: "t.square")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 64.0, height: 64.0)
.foregroundColor(.accentColor)
Text("Enter PIN code")
HStack {
TextField("", text: $pin)
.font(Font.system(size: 28, design: .default))
.frame(width:4*28.0, height:28.0)
.focusable()
.focused($pinIsFocused)
}
.onAppear(){
pinIsFocused = true
}
}
.padding()
}
}
Post not yet marked as solved
Hi..
My applications do not open until I turn on the VPN and change my region.
Can I find out the reason and solve this problem?
For your information, my applications are booking taxis in the Yemeni capital, Sanaa.
Thanks
Hi community:
Thanks for readme. I want to achieve get an adverb of frequency from a time interval or date component. So if I have something that measure one week, I want to get "weekly" as result, the same for 2 weeks "bi-weekly", month "monthly" and so on.
Is there any foundation API to get it?
Thanks in advance
I am using UIDatepicker,and I set a Chinese Calendar for it.It worked well in iOS16.2.
But now, the datePicker return -0614-MM-dd HH:mm:ss +0000 while it return 2023-MM-dd HH:mm:ss +0000 in iOS16.2,I do not know what is -0614?
I'm currently developing an application for iOS and I recently updated to the iOS 17 beta along with Xcode 15.0 beta. I am trying to use NumberFormatter to format a Double to a currency string (in my case, American Dollars $). Here is the snippet of my code:
let formatter = NumberFormatter()
formatter.currencySymbol = Locale.current.currencySymbol
print(Locale.current.currency)
print(Locale.current.currencySymbol)
print(Locale.current.currency?.identifier)
print(Locale.current)
formatter.numberStyle = .currency
When running this on iOS 16, I get the following output:
Optional("$")
Optional("USD")
en_US (current)
However, when running the same code on iOS 17 beta, the output is different:
nil
Optional("¤")
nil
en_001 (fixed)
It appears that the Locale's currency and identifier properties are returning nil, and the Locale itself is being identified differently.
Has anyone else encountered this issue with iOS 17 beta and Xcode 15.0 beta? Is this a bug in the beta versions, or have there been changes in the way Locale should be used for currency formatting?
Post not yet marked as solved
Using Swift's DateFormatter class, how does it convert abbreviated date format to languages that don't support abbreviated month names e.g. Urdu
For Example, the following code doesn't return the correct Urdu translation for abbreviated Month format.
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "MMM d, yyyy"
dateFormatter.locale = Locale(identifier: "ur-IN")
let date = Date()
let formattedDate = dateFormatter.string(from: date)
print(formattedDate)
// Expected: "جولائی ۱۲, ۲۰۲۳" for Jul 12, 2023
// Actual: "جول ۱۲, ۲۰۲۳"
Post not yet marked as solved
Is it possible to change the date formats used in the App Store Connect web interface?
It seems to me that things like the date range selection widget on the Sales & Trends page use only the US-style MM/DD/YYYY format. Is there some way to change this to YYYY-MM-DD or DD/MM/YYYY that I have missed?
Dear Experts,
NSLocale has a notification NSCurrentLocaleDidChangeNotification and a property autoupdatingCurrentLocale ("A locale which tracks the user’s current preferences"). These suggest that an app should be able to detect when the user changes their language preference while running, or when it is resumed from the background.
In practice, when I change language in the Settings app (either globally or just for my app), the app is terminated by iOS and restarts with new locale.
Is this the expected behaviour? I am wondering if there is something I need to do to advertise that the app can adopt language changes without restarting, or something.
Maybe only date-time formats, etc., trigger the notification but language changes don't?
Post not yet marked as solved
Hello,
I have an app which offers content and users can have access through a montly subscription în app. We plan to expand in a different Country in which we need a different Organization as owner of the app and the revenue genereted from users in the new released country should go to the new organization.
If there a way to keep the same app in store but to have multiple entities to manage them for different countries??
Post not yet marked as solved
I have been working on a Calendar App. i am getting date format 2023-08-25T7:07:00 pm which is not parsing in any date format.
Required Output:
2023-08-25T19:07:00
Getting fail with all date formatter
Here is the my code snippet
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd'T'hh:mm:ss a"
dateFormatter.locale = Locale(identifier: "en_US_POSIX")
dateFormatter.timeZone = TimeZone.current
if let date = dateFormatter.date(from: dateString) {
let formattedDateString = dateFormatter.string(from: date)
print(formattedDateString)
} else {
print("Invalid date format")
}
Help me on this.
Post not yet marked as solved
Hi
I have an app in the store that distributed to 2 region(IL and AU)
I want to push another app only to one region (IL)
But, I want the old version stay in AU region
How can I do it?
Post not yet marked as solved
Due to our app having different government clearances in each geographical region, we are required to have a different version in each region. While the apps are all fundamentally the same, is there any reason we can't have:
OurApp US - available in US
OurApp UK - available in UK only
OurApp EU - available in EU only
While I understand how to implement this, there is concern that the subsequent submissions might be flagged incorrectly by the 4.3 Spam rule. Users would never see more than one version of our app in their region's App Store. Does anyone have any knowledge or experience here? Is this kind of release strategy acceptable?
Post not yet marked as solved
Dear experts,
I get glyphs from the system font using CTFontGetGlyphsForCharacters, something like this:
UIFont* uifont = [UIFont monospacedDigitSystemFontOfSize: s weight: w];
CTFontRef font = (__bridge CTFontRef)uifont;
CTFontGetGlyphsForCharacters(font, ....);
The characters that I ask for are basically latin-1 plus a few others.
The app is not localised for Chinese. When I change the phone's default language to Chinese, this code gets glyphs for most characters OK but it fails for a few punctuation symbols:
91 = [
93 = ]
183 = middle dot
8220 = left double curly quote
8221 = right double curly quote
Can anyone guess what's going on here? What's special about those characters?
Thanks, Phil.
This simple text:
Text("10'20\"")
when the localisation is a RightToLeft, like Arabic
on iMac show "20'10
on iOS show 10'20"
Which is the correct one?
Why the are different?
Post not yet marked as solved
Our application should support locales for Albanian and Albanian(Kosovo). Xcode creates sq.lproj and sq-XK.lproj folders accordingly
Everything works fine in xcode, but if we upload to appstore we always see this warning. I tried specifying other names for sq-XK to match https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html aln, sq-RS, sq-KV, sq-KS, sq-Latn-XQ. The varning was always present. Is there any way to get rid of it?
WARNING ITMS-90176: "Unrecognized Locale - The locale used in localization directories at ("Payload/{AppName}.app/base.lproj") are invalid. iTunes supports BCP47 but not the UN M.49 specification. Refer to the Language and Locale Designations guide for more information on naming your language-specific directories."
Post not yet marked as solved
Hi all,
My app is available in English and Arabic.
However, when searching for the app in iOS App Store, by typing the app name in Arabic, it does not show up in the suggested apps.
This occurs in English but also Arabic phone/app configuration.
On the other hand, on Android I don't have this issue.
Do you know what to do to fix this?
We have already added the app name in the AR app store keywords / description, but it did not help as it's still not showing up.
Thank you
Post not yet marked as solved
What's the right way to implement key equivalent matching that handles non-Roman/Latin layouts?
E.g. pressing Cmd+Option+C in a Greek layout produces an NSEvent with chars="ç" unmodchars="ψ", neither of which is going to match a key equivalent of Cmd+Option+C by simile comparison, yet performKeyEquivalent on a button with that exact key equivalent returns YES and activates the button.
How would someone replicate that?
[NSEvent charactersByApplyingModifiers:] also reports "ç", and so does UCKeyTranslate. Yet the Keyboard Viewer shows a modifier layer with "c", not the "ç" that the event reports: