In my app, its optional that a user sets a timer for a given thing. For that, I wanted to show 0hrs and 0 mins as default selected time interval of the countdown timer. if there is a change, the timer is automatically set to that value using event handling (did end editing).
However, 0hrs and 1 mins is what the default timer shows which can come across as the timer being preset to 1 minute. How can I design my user-interface such that the default is indicated as 0hr 0mins and if the user changes it, its set to that time.
This is more of a design question. Maybe something in HIG?
Here is how it currently looks...
UIKit
RSS for tagConstruct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.
Post
Replies
Boosts
Views
Activity
Hello.
I have a strange issue with localized text.
On some device (iPhone X with iOS 15.2.1 and iPhone 14 Pro with iOS 16.7.2) the localized isn't loaded and the UILabel is empty.
In all the others UILabel in the view the localized text is correctly showed.
It works perfectly on iPhone 8 with iOS 16.4.1, iPhone 8 with iOS 16.7 iPhone 12 with iOS 17.3, and also on iPhone 14 Pro 17.2 Simulator.
Below the text from the localizable file:
"m_alert_message" = "E' disponibile nello store la nuova App CAME Access. Vuoi iniziare la procedura per trasferire i dati di impianto nella nuova App?";
and how set the text property of the UILabel:
messageLabel.text = NSLocalizedString("m_alert_message", comment: "")
messageLabel.lineBreakMode = .byWordWrapping
messageLabel.textAlignment = .center
messageLabel.numberOfLines = 0
messageLabel.font = UIFont(name: XipAppearance.fontName, size: XipAppearance.fontSizeText)
containerView.addSubview(messageLabel)
Another strange thing is all other texts in all other views are correctly loaded and showed.
Does anyone have any idea what the problem might be?
From the below tests ran on my iPhone 12, the model and name API from UI device both return "iPhone" only, is there any other way that we can get "iPhone 12" instead of iPhone?
Since the API stop returning full model information from iOS16+, we have been getting not sufficient model information for our app, so seeking for a API that does not require entitlement review/update for such purpose (as we have fail that request once before)
code:
print("UIDevice.current.model: (UIDevice.current.model)")
print("UIDevice.current.name: (UIDevice.current.name)")
log:
UIDevice.current.model: iPhone
UIDevice.current.name: iPhone
I'm trying to integrate AR into my app, and I want to be able to present a the UIViewController containing the ar view after pressing a sprite in SKScene. I'm trying to look for a way to present this view controller in touchesBegan however I'm not able to find any reference on this.
I'd really appreciate any help.
Hi all,
I'm using AVPictureInPictureController to show CMSampleBuffers. No problems with that.
When the Picture in Picture view/window is active and the phone is locked for long enough (~30 seconds), the Picture in Picture view/window will show black. I've noticed the same happens with Netflix, so I assume there is no way around that.
So when that happens (i.e. Picture in Picture view/window will showing black), I would like to just stop Picture-in-Picture mode. For this, I would need to be able to detect when Picture in Picture view/window will starts showing black pixels.
I've tried listening for UIApplication lifetime events (such as didResignActive. and didMoveToBackground), but as my app is a location-based app that received Location updates in the background, those are not at all an indicator of the black PiP window.
Any suggestions for me on how to handle the PiP window showing a black window upon unlocking the phone?
Hello.
We've been collecting a lot of device feedback crashes, but we've been unable to reproduce them and can't fix them
the Main Thread Checker that opened Xcode has not been able to track the specific location, but there is this crash feedback online every day. At present, I check that all devices with iOS 16.0 system or above appear, and we need the official to help us solve this intractable problem
The stack in the xccrashpoint file does not provide effective stack information, so I cannot locate the specific bug. We have not been able to reproduce the problem using Xcode, so we need your assistance.
I have also seen many people on the forum with similar feedback, but nothing seems to come to fruition
https://developer.apple.com/forums/thread/129686?login=true&page=1#775136022
https://stackoverflow.com/questions/56791779/how-to-track-auto-layout-assertions-from-background-thread
https://forums.developer.apple.com/forums/thread/661349
Launch Time: 2023-09-29 16:55:13.4225 +0800
OS Version: iPhone OS 16.7 (20H19)
Release Type: User
Baseband Version: 5.03.01
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001927a4c24
Termination Reason: SIGNAL 5 Trace/BPT trap: 5
Terminating Process: exc handler [5180]
Triggered by Thread: 36
Last Exception Backtrace:
0 CoreFoundation 0x18b220c44 __exceptionPreprocess + 164 (NSException.m:202)
1 libobjc.A.dylib 0x1842bfe5c objc_exception_throw + 60 (objc-exception.mm:356)
2 CoreAutoLayout 0x1a86fde68 _AssertAutoLayoutOnAllowedThreadsOnly + 328 (NSISEngine.m:0)
3 CoreAutoLayout 0x1a86f4e40 -[NSISEngine withBehaviors:performModifications:] + 36 (NSISEngine.m:1982)
4 UIKitCore 0x18d28a3a8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1872 (UIView.m:18670)
5 QuartzCore 0x18c744ec4 CA::Layer::layout_if_needed(CA::Transaction*) + 500 (CALayer.mm:10311)
6 QuartzCore 0x18c758440 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 148 (CALayer.mm:2519)
7 QuartzCore 0x18c76986c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 444 (CAContextInternal.mm:2714)
8 QuartzCore 0x18c798e3c CA::Transaction::commit() + 648 (CATransactionInternal.mm:432)
9 QuartzCore 0x18c7e368c CA::Transaction::release_thread(void*) + 228 (CATransactionInternal.mm:635)
10 libsystem_pthread.dylib 0x1eb076b9c _pthread_tsd_cleanup + 620 (pthread_tsd.c:416)
11 libsystem_pthread.dylib 0x1eb079560 _pthread_exit + 84 (pthread.c:1719)
12 libsystem_pthread.dylib 0x1eb0760cc _pthread_wqthread_exit + 80 (pthread.c:2578)
13 libsystem_pthread.dylib 0x1eb075e64 _pthread_wqthread + 424 (pthread.c:2612)
14 libsystem_pthread.dylib 0x1eb075b7c start_wqthread + 8
Thread 0 name:
Thread 0:
0 CoreFoundation 0x000000018b2259a8 CFStringFindWithOptionsAndLocale + 292 (CFString.c:0)
1 CoreFoundation 0x000000018b297470 -[__NSCFString hasSuffix:] + 24 (CFObject.m:523)
2 UIKitCore 0x000000018d49f48c -[UIKBTree visualStylingForScreenTraits:] + 116 (UIKBTree.m:1240)
3 UIKitCore 0x000000018d5f9828 -[UIKBTree visualStyling] + 76 (UIKBTree.m:1349)
4 UIKitCore 0x000000018dd9d72c -[UIKeyboardLayoutStar downActionFlagsForKey:] + 360 (UIKeyboardLayoutStar.m:10167)
5 UIKitCore 0x000000018dd8a6cc -[UIKeyboardLayoutStar playKeyFeedbackIfNecessaryForTouchDownOnKey:touchInfo:] + 60 (UIKeyboardLayoutStar.m:4972)
6 UIKitCore 0x000000018dd942fc -[UIKeyboardLayoutStar touchDownWithKey:withTouchInfo:atPoint:executionContext:] + 2784 (UIKeyboardLayoutStar.m:7916)
7 UIKitCore 0x000000018dd9338c -[UIKeyboardLayoutStar completeHitTestForTouchDown:executionContext:] + 1156 (UIKeyboardLayoutStar.m:7620)
8 UIKitCore 0x000000018dd92ed8 __51-[UIKeyboardLayoutStar touchDown:executionContext:]_block_invoke_2 + 272 (UIKeyboardLayoutStar.m:7518)
9 UIKitCore 0x000000018d653378 -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:] + 184 (UIKeyboardTaskQueue.m:204)
10 UIKitCore 0x000000018dd8ae90 __94-[UIKeyboardLayoutStar performHitTestForTouchInfo:touchStage:executionContextPassingUIKBTree:]_block_invoke + 464 (UIKeyboardLayoutStar.m:5098)
11 UIKitCore 0x000000018d653378 -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:] + 184 (UIKeyboardTaskQueue.m:204)
12 UIKitCore 0x000000018de38678 __79-[UIKeyboardImpl performHitTestForTouchEvents:executionContextPassingNSNumber:]_block_invoke_2 + 76 (UIKeyboardImpl.m:11965)
13 UIKitCore 0x000000018d65321c -[UIKeyboardTaskEntry execute:] + 208 (UIKeyboardTaskQueue.m:868)
14 UIKitCore 0x000000018d653100 -[UIKeyboardTaskQueue continueExecutionOnMainThread] + 304 (UIKeyboardTaskQueue.m:446)
15 Foundation 0x000000018551074c __NSThreadPerformPerform + 264 (NSThread.m:1046)
16 CoreFoundation 0x000000018b2ea0cc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957)
17 CoreFoundation 0x000000018b2f6758 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001)
18 CoreFoundation 0x000000018b27b578 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038)
19 CoreFoundation 0x000000018b291064 __CFRunLoopRun + 828 (CFRunLoop.c:2953)
20 CoreFoundation 0x000000018b29637c CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
21 GraphicsServices 0x00000001c67b835c GSEventRunModal + 164 (GSEvent.c:2196)
22 UIKitCore 0x000000018d622f58 -[UIApplication _run] + 888 (UIApplication.m:3782)
23 UIKitCore 0x000000018d622bbc UIApplicationMain + 340 (UIApplication.m:5372)
24 libswiftUIKit.dylib 0x0000000193cb40b0 UIApplicationMain(_:_:_:_:) + 104 (UIKit.swift:538)
25 SansiroLive 0x000000010283cda8 specialized static UIApplicationDelegate.main() + 28 (AppDelegate.swift:17)
26 SansiroLive 0x000000010283cda8 static AppDelegate.$main() + 28 (ThirdLoginManager.swift:0)
27 SansiroLive 0x000000010283cda8 main + 124
28 dyld 0x00000001aa7d4dec start + 2220 (dyldMain.cpp:1165)
Hello, community.
We are adding visionOS support to our application and have an issue without a solution because of a system UIKit bug.
There is a system bug with cycled recalling textFieldShouldReturn function after the first Return button usage (with this function returning true), and calling resignFirstResponder textField will get in the cycle, and there is no way to stop calling the textFieldShouldReturn func.
Repro steps:
Enter text to UITextField
Press Return button on keyboard
textFieldShouldReturn called (return true after step 4)
call resignFirstResponder
call becomeFirstResponder or tap on UITextField
return to step 3
The same problem exists in system application Reminders.
Repro steps:
Create a new reminder with a title and description
Set pointer to title textField
Press Return button on keyboard
App will try to create a new reminder and, after less than a second, return to the first reminder
The bug is only for visionOS, on iOS/iPadOS all is OK.
We assume that there is a flag for Return button usage, which checks on becomeFirstResponder logic, and in visionOS (iPadOS adaption), it does not clear this after handling button pressing.
In my app, the user can set a timer for an activity. I want to show a simple progress bar that progresses every 1 second and stops (100%) at the end of the time interval of the timer.
example, think of the progressbar of a song being played which finishes on the length of the song.
I've read about TimerPublisher but am not sure how to implement it. Can someone help me out over here please?
Thanks
Neerav
For printing from worker thread to a UIPrinter(whose url i have saved ) i am doing this and able to print :
func PrintPdfDocument (pDocument:Data)
{
// Create a print interaction controller
let printController = UIPrintInteractionController.shared
// Set the printing options
let printInfo = UIPrintInfo(dictionary:nil)
printInfo.jobName = "Print Job "
printController.printInfo = printInfo
printController.showsPageRange = true
// Set the PDF document to be printed
printController.printingItems = pDocument
printController.print(to: defaulttprinter, completionHandler: { (controller, completed, error) in
if completed {
print("Printing successful!")
} else {
if let error = error {
print("Printing failed with error: \(error.localizedDescription)")
} else {
print("Printing was canceled.")
}
}
})
}
When i call PrintPdfDocument (pDocument:Data) function , more than once with diffrent data shown below :
DispatchQueue.global().async {
PrintPdfDocument (pDocument:data1)
}
DispatchQueue.global().async {
PrintPdfDocument (pDocument:data2)
}
DispatchQueue.global().async {
PrintPdfDocument (pDocument:data3)
}
Printer is printing only one document(data1) .
For other call is not executing printController.print (to....) function inside PrintPdfDocument.
I'm observing a sporadic bug in our web client where incoming URLs (triggered by a Push Notification or link tapped in another app) do not trigger either of the two expected API callbacks noted in the developer documentation for UISceneDelegate.
Specifically, Apple's docs say:
If your app has opted into Scenes, and your app isn’t running, the system delivers the URL to the scene(_:willConnectTo:options:) delegate method after launch, and to scene(_:openURLContexts:) when your app opens a URL while running or suspended in memory.
Our client app has opted into scenes and the two callbacks mentioned above work reliably most of the time for incoming URLs. However, using the exact same test links or push notifications, I'm able to reproduce intermittent issues where I can see that neither of the above callbacks are triggered when the app is foregrounded to handle a URL.
The bug seems to occur when:
The app has been previously launched, and is backgrounded
It's left in the background for some time (system memory pressure, from using other apps etc., might possibly play a factor also)
In this scenario, sometimes when either an external link or URL via push notification is opened, I can see that neither of the two iOS delegate methods for UISceneDelegate are called. Our app is brought to the foreground correctly as though the URL will be handled, but the URL/link is not processed since it is never sent to our client.
A few other notes:
When the bug is repro'd using push notifications, I can see that our app receives a callback to userNotificationCenter:didReceive:, so the push notification definitely arrives. However, as noted above, the normal 2 API callbacks for UISceneDelegate are never triggered, and since those two callsites are where we handle incoming URLs, the URL from the push notification is never opened
I haven't been able to observe any code in our app that precedes these hooks in our scene delegate that could be interfering. (As mentioned above, the same steps to replicate work the majority of the time)
Does anyone know whether this could be a possible iOS bug?
Any help/suggestions are greatly appreciated. Thank you
I am working on enabling the option for users to save a video from a post in a social media app to their cameral roll. I am trying to use PHPhotoLibrary to perform the task similarly to how I did the functionality for saving images and gifs. However, when I try to perform the task with the code as is, I get the following errors:
Error Domain=PHPhotosErrorDomain Code=-1 "(null)"
The operation couldn’t be completed. (PHPhotosErrorDomain error -1.)
The implementation is as follows:
Button(action: {
guard let videoURL = URL(string: media.link.absoluteString) else {
print("Invalid video url.")
return
}
PHPhotoLibrary.shared().performChanges({
PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: videoURL)
print("Video URL: \(videoURL)")
}) { (success, error) in
if let error = error {
debugPrint(error)
print(error.localizedDescription)
} else {
print("Video saved to camera roll!")
}
}
}) {
Text("Save Video")
Image(systemName: "square.and.arrow.down")
}
The video URL is successfully fetched dynamically from the post, but there's an issue with storing it locally in the library. What am I missing?
I have a couple of actions in the leading and the trailing swipes of a table view cell. Like in the mail app, I want to unswipe the cell as soon as an action is selected. Notice how the 'Mark as read' blue colored action disappears when its selected.
Any guesses how it can be done?
Neerav
Can the contentview itself be displayed as a modal (popup) view?
Can the content view itself be displayed transparently(color clear)?
hi everyone. im new to xcode and wondering if anyone has any idea for what to do when your initial view controller keeps showing a black screen. ive done the following
ensured Main storyboard file base name in info.pl is set to my storyboard. also under application scene manifest --> scene configurations --> application session role --> item 0 i have storyboard name as my storyboard and delegate class name as my SceneDelegate but I keep receiving this error
2024-02-13 22:42:47.452242-0500 PROJECT-NAME[11302:838011] [SceneConfiguration] Info.plist configuration "(no name)" for UIWindowSceneSessionRoleApplication contained UISceneDelegateClassName key, but could not load class with name "SceneDelegate". 2024-02-13 22:42:47.452641-0500 PROJECT-NAME[11302:838011] [SceneConfiguration] Info.plist configuration "(no name)" for UIWindowSceneSessionRoleApplication contained UISceneDelegateClassName key, but could not load class with name "SceneDelegate". 2024-02-13 22:42:47.456532-0500 PROJECT-NAME[11302:838011] [WindowScene] There is no scene delegate set. A scene delegate class must be specified to use a main storyboard file.
the initial view controller box is checked for the correct controller (HomePageController)
ive added print statements to my viewDidLoad() in my HomePageController
(i guess one weird thing is that i cant set 'main interface' to my main storyboard in the deployment info section)
im really not sure what else to do, and any help would be really appreciated. im a beginner so all of this is a bit difficult. this is my info.pl file: https://drive.google.com/file/d/1W-KOH3BjqgfJf10n9LM5bRTYHXQYM9ER/view?usp=sharing
When I add or delete data of my entity type I can see the updates (between the simulator and the phone) but when i edit I dont see the updates although table view is reloaded. The console says
Ignoring remote change notification because it didn't change any entities tracked by persistent history
When I rebuild the app for both device and simulator I see it reflecting the most current changes.
Any help?
Neerav
I am taking a reference to a VC in app delegate and using a UIColorPickerController extension with the following code, I'm setting this VC as a delegate to the picker. I need to take these lengthy steps because there is no reference to the picker that a UIColorWell displays!
This way, I can set the background color of the VC while the user selects different colors from picker, one after another. This is the give a live effect or color change.
However, I dont see this happening. The delegate is not being called.
Any help?
import Foundation
import UIKit
extension UIColorPickerViewController{
open override func viewDidLoad() {
super.viewDidLoad()
let appDelegate = UIApplication.shared.delegate as! AppDelegate
delegate = appDelegate.addOrEditVC
}
}```
I am trying to recreate Discrete scrubber in SwiftUI with haptic feedback and snap to nearest integer step. I use ScrollView and LazyHStack as follows:
struct DiscreteScrubber: View {
@State var numLines:Int = 100
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack {
ForEach(0..<numLines, id: \.self) { _ in
Rectangle().frame(width: 2, height: 10, alignment: .center)
.foregroundStyle(Color.red)
Spacer().frame(width: 10)
}
}
}
}
}
Problem: I need to add content inset of half the frame width of ScrollView so that the first line in the scrubber starts at the center of the view and so does the last line, and also generate haptic feedback as it scrolls. This was easy in UIKit but not obvious in SwiftUI.
Hello,
I am currently developing an iOS app and need to check if the Classic Invert accessibility setting is enabled.
According to the Apple documentation, the isInvertColorsEnabled property should indicate whether the Classic Invert setting is enabled:
"A Boolean value that indicates whether the Classic Invert setting is in an enabled state."
https://developer.apple.com/documentation/uikit/uiaccessibility/1615167-isinvertcolorsenabled
However, in my app, isInvertColorsEnabled only returns true when the Smart Invert setting is enabled. It always returns false when Classic Invert is enabled.
Is this a bug in the documentation?
If so, is there another way to check if Classic Invert is enabled?
Thank you for your time.
Additional information:
Xcode 15,
iOS 17.0
I noticed two differences in my share extension's behaviour compared to my main app:
The layer.presentation() values can be massively out of date, which means that continuing animations from their current position is not possible. This is both true for manually checking the layer.presentation() values, as well as for letting UIKit doing the replacement-continuation via UIView.animate(..., options: [.beginFromCurrentState], ...).
UI updates seem to be ignored if the share extension performs heavy calculation. Interestingly, it doesn't seem to matter whether I do this calculation in the main thread or in a background thread, and call the main thread for UI updates via DispatchQueue.main.sync { ... }. I see my console in Xcode filling with progress updates from print(progress) statements, but the UI just doesn't move. Once the heavy processing is done, it instantly updates again.
I assume that 1 and 2 are related. If I cannot get the UI to draw while the computation is done, I probably also can't get up-to-date presentation layer values.
Are there any explanations for this behaviour, and any advice on how I could circumvent the problem? Again, this is specific to my share extension and doesn't happen in my main app.
I wanted to post this here in the hope that this will draw attention to what I think is a serious change in behavior that could negatively affect Catalyst apps in macOS 14.4.
Prior to macOS 14.4, when the completion handler was invoked from calling dismiss() to dismiss a presented view controller in a Catalyst app, the dismissed controller no longer appeared in the chain. That is to say that if the root view controller presents View Controller A, when View Controller A is dismissed, the root view controller's presentedViewController property is nil when the completion handler for dismiss() is called.
With macOS 14.4, this is no longer the case. If the root view controller presents View Controller A and then View Controller A is dismissed, the presentedViewController property of the root view controller still refers to Controller A when dismiss()'s completion handler is called.
The side effect of this change in behavior means that if you try to present another view controller from the completion handler of the one being dismissed, it will fail to show because the top most view controller in the chain is the controller being dismissed and presenting from it will result in nothing showing up because it is removed from the chain immediately after the completion handler is invoked. Before macOS 14.4, it the top of the chain would have been the controller that presented the controller that was dismissed, which is what you actually want.
This problem does not exist in the betas for iOS 17.4 or iPadOS 17.4. It appears to affect only Catalyst apps running under macOS 1.4.4.
I think this change in behavior has the potential to affect a number existing Catalyst apps and it may not be obvious to the user something is going wrong. It really should be fixed before macOS 14.4 is released to the public.
I've created a feedback with a sample Xcode project that demonstrates the problem (feedback number FB13622757).