Hi,
In a Mac Catalyst app, I need to allow the user insert a passcode using a UITextField.
The field is used to insert a one time passcode and I want to keep the content hidden. For this reason I set the isSecureTextEntry property to true.
passcodeTextField.isSecureTextEntry = true
By doing this, a button to allow the user to pick a password from the keychain is displayed:
This option in my case should not appear because the password is a one time password that change every time. For that reason I set the textContentType to oneTimeCode.
passcodeTextField.textContentType = .oneTimeCode
This actually removes the password button, but introduce something weird. If the user type something and then delete everything, a big empty box appear under the field:
I have no idea what this box is and why it appears.
Does anyone know why it appears and how I can remove it?
Thank you
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hi,
Just want to understand what is the current state of iOS 15 prewarming app delegate behaviour.
There is a lot of confusion (and a lack of documentation) about which app delegate methods are called during prewarming.
It's not clear if didFinishLaunchingWithOptions will be called or not during prewarming.
A lot of applications are counting on UserDefaults and Keychain access in didFinishLaunchingWithOptions, but sadly these two features seems to be unavailable during prewarming causing issues.
Some users say that this was the case before 15.4 and that from 15.4 the didFinishLaunchingWithOptions app delegate method is no more called during prewarming.
Just want to know if we can have an official statement about this.
It is safe, from iOS 15.4 onwards, to use UserDefaults and access Keychain in the didFinishLaunchingWithOptions app delegate method?
Thank you
Hi,
I just discovered a weird bug with UITextView on iOS 16 beta 4.
For some reason now, when the scrolling is disabled, the intrinsic content size of the text view is considering the line spacing even when the textview is empty.
For example, in the below code we are setting a big lineSpacing of 50 to the text view typingAttributes attribute.
class ViewController: UIViewController {
@IBOutlet weak var textView: UITextView! {
didSet {
//Let's set the textView typingAttributes with a lineSpacing of 50.
var attributes = [NSAttributedString.Key: Any]()
let paragraphStyle: NSMutableParagraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 50
attributes[NSAttributedString.Key.paragraphStyle] = paragraphStyle
attributes[NSAttributedString.Key.font] = UIFont.preferredFont(forTextStyle: .body)
textView.typingAttributes = attributes
}
}
}
On previous iOS versions, everyting it's ok and the line spacing is added only when there are more than one line (see below image).
However, on iOS 16 beta 4, the line spacing is added also when the content is empty (see below image on the left). A soon as we type something the height collapse to the correct height (see below image in the center).
Is this a new expected behavior or a bug? If it is a bug, someone has found a temporary fix for that?
Thank you
I’m exploring the new Xcode 15 string catalog feature.
I see that for every sentence there is a “screenshots” field in the Xcode inspector (see image). How can we populate this field?
Thank you
Is it possible to use a string catalog to localize a settings bundle?
Currently, to localize a Settings.bundle, we need to create a folder for each language with a single strings file inside.
For example:
Settings.bundle
en.lproj > Root.strings
fr.lproj > Root.strings
de.lproj > Root.strings
...
Any way to convert that to a string catalog?
Thank you
I need more time to adapt to the new iOS 26 UI, so I set the "UIDesignRequiresCompatibility" attribute to "Yes."
This works, but now all large titles are not aligned with the content.
Below you can see an example, but I have the issue with all large titles.
All good on iOS 18.
Does anyone have an idea why and how can i fix it?
Hi,
Inside a Mac Catalyst app, I need to display a popover starting from an NSToolbarItem contained inside the app toolbar (like the Apple Maps Mac app does, see below image).
In order to do that, when I press the button I need to find the toolbar item view and use it as popover anchor.
How can I find the view or frame of an NSToolbarItem on Mac Catalyst?
A property that could help me is the NSToolbarItem "view" property (NSView), but that property has been marked has unavailable in Mac Catalyst.
Any idea?
Thank you
I'm using the following code to get the height of the keyboard:
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(
self,
selector: #selector(keyboardHeight),
name: UIResponder.keyboardDidChangeFrameNotification,
object: nil
)
}
@objc private func keyboardHeight(notification: Notification) {
guard let keyboardRect = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue else { return }
print("==> keyboardFrameEndUserInfoKey height: \(keyboardRect.size.height)")
}
}
This code on iPad work correctly when the keyboard is normal but it does not work when the keyboard is floating.
After the user tap on a text field, the keyboard appear and the keyboardDidChangeFrameNotification notification is called.
If the keyboard is floating then the first time we get a wrong height of 362. If the user then manually move somewhere the floating keyboard the notification is called again and the correct value of 308 is returned.
It is a bug or I miss something? I need to be able to get the correct height the first time the keyboard appear.
This is happening on iOS 13 and iOS 14.
Any idea?
Hi,
I'm starting using StoreKit 2 and I have some questions regarding transactions.
To check which non-consumable in-app purchases the user has purchased, immediately after starting the app I look at Transaction.currentEntitlements.
That's working fine, but I have some questions about it.
Question 1:
What happens if the user is not connected to the internet? Will Transaction.currentEntitlements still return data?
Question 2:
What happens if the user sign out from the AppStore? Will Transaction.currentEntitlements be empty?
Question 3:
What happens if the user sign in AppStore with different credentials? Transaction.currentEntitlements will return the transaction of the new AppStore user?
Thank you
Hi,
I'm testing one of my app on iOS 14 with Xcode 12 beta 3 (12A8169g) and I have a problem with my storyboards.
Xcode give me this error for all the storyboards that contain a split view controller:
An internal error occurred. Editing functionality may be limited.
The log generated by the Xcode "Report a bug" button say:
Exception name: NSInvalidArgumentException
Exception reason: UITabBarController is unsupported as viewController for -[UISplitViewController setViewController:forColumn:] in Primary column
It worked correctly on Xcode 12 beta 2.
Has anyone encountered the same problem and found a way to fix it?
Thank you
Hi,
I need to generate the image of a map at a specific resolution.
I tried to use the following code:
let options = MKMapSnapshotter.Options()
options.size = CGSize(width: 300, height: 200)
options.scale = 1.0
options.mapRect = mapRect
let mapSnapshotter = MKMapSnapshotter(options: options)
if let snapshot = try? await mapSnapshotter.start() {
let image = snapshot.image
}
Since I specified the options.scale to be 1 I expect the image resolution to be exactly 300x200 pixel (and with a scale of 1).
Unfortunately the resulting image has a scale factor of 3 (on an iPhone) and the actual resolution is 900x600 pixel.
I also tried, instead of using the scale option, to set the traitCollection option, like this:
options.traitCollection = UITraitCollection(displayScale: 1.0)
but I still get a 3x scale image with a resolution of 900x600.
Why is the scale option ignored? I miss something?
Thank you
Hi,
I found a case that cause a list to never deselect the row when the back button is pressed.
In the following code I modally present a list. When you select a row another list is displayed. If you select a row of the second list and you go back the row will stay selected.
This is the code:
struct ContentView: View {
		@State var modalVisible = false
		var body: some View {
				Button(action:{
						self.modalVisible.toggle()
				}) {
						Text("Open modal")
				}
				.sheet(isPresented: $modalVisible) {
						NavigationView {
								List {
										NavigationLink("Item", destination: List {
												NavigationLink("Sub Item", destination: Text("If you go back the row will stay selected."))
										})
}
}
}
}
}
Does anyone know if there is a way to force the list to deselect the row when the back button is pressed?
Thank you