Construct and manage graphical, event-driven user interfaces for iOS or tvOS apps using UIKit.

UIKit Documentation

Post

Replies

Boosts

Views

Activity

show bugs in iOS 18
I used tabBarItem & UITabBarController create a demo app. then I set every pages backgroudcolor as red. when I change to every pages withing the tabBarItem at bottom. the page's background color highlight every time. I don't know why. Is this the new UIKit's bug?
2
0
271
Sep ’24
Watch OS11 My recording play gets paused after a while
Watch OS11 My recording play gets paused when watch I turned down. It was not happening in previous versions. In my app I recorded my recording. And When I play it in my app, it was playing good in debug mode(when Xcode is connected) could not debug. Otherwise, it was automatically paused(when my wrist is down or inactivity time is elapsed) I want it to be continued.
1
0
316
Sep ’24
UI freezes during zooming action in UIScrollView
I implemented the view displaying the video on a UIScrollView, but the UI freezes during the zooming action. The clock and status bar both freeze, but interestingly, if I touch the tab bar, everything starts working again after a few seconds. I am experiencing this issue only on an iPhone 12 Pro running iOS 16.5.1, but it doesn’t occur on other phones. I would like to know if this is an OS bug. Has anyone else experienced the same issue?
0
0
108
Sep ’24
iOS18 Must appear crash bug
1、 hook respondsToSelector: 接口,比如 hook 后的接口名字为 yy_respondsToSelector: 2、在 yy_respondsToSelector 中使用传入的参数 aSelector。示例代码如下: (BOOL) yy_respondsToSelector:(SEL)aSelector { if ([self yy_respondsToSelector:aSelector]) { return YES; } if ([self.selectorNameArray containsObject:NSStringFromSelector(aSelector)]) { return YES; } return NO; } 2、在自定义 UIViewController,比如 YYViewController,实现下述代码 (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; NSMutableArray *vcs = [[NSMutableArray alloc]init]; [vcs addObject:[[UIViewController alloc] init] ]; [vcs addObject:[[UIViewController alloc] init] ]; self.navigationController.viewControllers = vcs; } 3、当页面 YYViewController加载并执行 viewDidAppear 时候, App 一定会出现崩溃,因为 aSelector 是一个非法指针,访问就会崩溃
1
0
221
Sep ’24
iOS18.0 and iOS18.1 will inevitably crash. - (BOOL) respondsToSelector:(SEL)aSelector aSelector may be invalid, resulting in a crash
Hook respondsToSelector: interface. For example, the name of the hooked interface is yy_respondsToSelector: 2. Use the passed parameter aSelector in yy_respondsToSelector. The sample code is as follows: (BOOL) yy_respondsToSelector:(SEL)aSelector { if ([self yy_respondsToSelector:aSelector]) { return YES; } if ([self.selectorNameArray containsObject:NSStringFromSelector(aSelector)]) { return YES; } return NO; } 2. In a custom UIViewController, such as YYViewController, implement the following code (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; NSMutableArray *vcs = [[NSMutableArray alloc]init]; [vcs addObject:[[UIViewController alloc] init] ]; [vcs addObject:[[UIViewController alloc] init] ]; self.navigationController.viewControllers = vcs; } 3. When the page YYViewController is loaded and viewDidAppear is executed, App There will definitely be a crash, because aSelector is an illegal pointer, and access will crash
0
0
199
Sep ’24
iOS18.0 及 iOS18.1 必现崩溃。- (BOOL) respondsToSelector:(SEL)aSelector 中 aSelector 可能无效,导致必现崩溃
1、 hook respondsToSelector: 接口,比如 hook 后的接口名字为 yy_respondsToSelector: 2、在 yy_respondsToSelector 中使用传入的参数 aSelector。示例代码如下: (BOOL) yy_respondsToSelector:(SEL)aSelector { if ([self yy_respondsToSelector:aSelector]) { return YES; } if ([self.selectorNameArray containsObject:NSStringFromSelector(aSelector)]) { return YES; } return NO; } 2、在自定义 UIViewController,比如 YYViewController,实现下述代码 (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; NSMutableArray *vcs = [[NSMutableArray alloc]init]; [vcs addObject:[[UIViewController alloc] init] ]; [vcs addObject:[[UIViewController alloc] init] ]; self.navigationController.viewControllers = vcs; } 3、当页面 YYViewController加载并执行 viewDidAppear 时候, App 一定会出现崩溃,因为 aSelector 是一个非法指针,访问就会崩溃
1
0
283
Sep ’24
ios 18 Crash
My project use manual reference counting and crash with UIAlertController when touch to Action Button: UIAlertController alert = [[UIAlertController alertControllerWithTitle:@"fsđs" message:@"fsđs" preferredStyle:UIAlertControllerStyleAlert ]autorelease]; UIAlertAction actionOk = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:nil]; [alert addAction:actionOk]; [self.window.rootViewController presentViewController:alert animated:YES completion:^{ }];
2
1
449
Sep ’24
Background Decoration View Overlapping Collection View Cells
I am encountering an issue with my UICollectionView layout where the background decoration view is overlapping the collection view cells. Below is the relevant code for my layout configuration: let itemSize = NSCollectionLayoutSize( widthDimension: .absolute(60), heightDimension: .absolute(100) ) let item = NSCollectionLayoutItem(layoutSize: itemSize) let groupSize = NSCollectionLayoutSize( widthDimension: .fractionalWidth(1), heightDimension: .absolute(100) ) let group = NSCollectionLayoutGroup.horizontal( layoutSize: groupSize, subitems: [item] ) let section = NSCollectionLayoutSection(group: group) section.decorationItems = [ NSCollectionLayoutDecorationItem.background(elementKind: "customBackgroundElementKind") ] return section Problem: The background decoration view is appearing on top of the collection view cells, which results in the cells being obscured. This issue is specific to iOS 18 and does not occur on iOS 17 and below. Request: Can anyone provide guidance or suggest a solution to ensure the decoration view does not overlap the collection view cells specifically on iOS 18? Thank you!
4
2
444
Sep ’24
IOS 17.4 - 17.5 bug when copying and pasting HTML (rich) text
Hello we have created a function that is expanding copy module to support html format. Everything inside that function works fine but on 17.4+ IOS version copying the html element strike-through tag is not working (other HTML elements are working fine) . Looking the logs seems like are getting stripped. Also list that have indents won't work on paste indent is missing. Here is the code: void copyToClipboard(NSString *htmlContent) { UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; [pasteboard setValue:htmlContent forPasteboardType:@"public.html"]; } Does anyone know fix for this or when this will be fixed or will it be fixed in next update?
0
0
204
Sep ’24
What is ChronoKit.InteractiveWidgetActionRunner.Errors Code 1?
This is a follow up to this post about building a Control Center widget to open the app directly to a particular feature. I have it working in a sample app, but when I do the same thing in my full app I get this error: [[com.olivetree.BR-Free::com.olivetree.BR-Free.VerseWidget:com.olivetree.BR-Free.ContinueReadingPlanControl:-]] Control action: failed with error: Error Domain=ChronoKit.InteractiveWidgetActionRunner.Errors Code=1 "(null)" Google has nothing for any of that. Can anyone shed light on what it means? This is my control and its action: @available(iOS 18.0, *) struct ContinueReadingPlanControl : ControlWidget { var body: some ControlWidgetConfiguration { StaticControlConfiguration(kind: "com.olivetree.BR-Free.ContinueReadingPlanControl") { ControlWidgetButton(action: ContinueReadingPlanIntent()) { Image(systemName: "book") } } .displayName("Continue Reading Plan") } } @available(iOS 18.0, *) struct ContinueReadingPlanIntent : ControlConfigurationIntent { static let title: LocalizedStringResource = "Continue Reading Plan" static let description = IntentDescription(stringLiteral: "Continue the last-used reading plan") static let isDiscoverable = false static let opensAppWhenRun: Bool = true @MainActor func perform() async throws -> some IntentResult & OpensIntent { let strUrl = "olivetree://startplanday" UserDefaults.standard.setValue(strUrl, forKey: "StartupUrl") return .result(opensIntent: OpenURLIntent(URL(string: strUrl)!)) } } Note also that I'm pulling this from Console.app, streaming the logs from my device. I don't know of a way to debug a Control Center widget in Xcode, though this thread implies that it's possible.
2
0
441
Sep ’24
How does OpenIntent in a control widget actually open the app to the target feature?
I want to add a Control Center widget for my app that will open the app to a particular feature. I'm looking at the "Open your app with a control" example here, which seems like exactly what I want: Set your control’s action to an app intent that conforms to OpenIntent to open your app when someone uses a control. Using OpenIntent allows you to take someone to a specific area of your app when a control performs its action. The example doesn't show exactly how to hook up the LaunchAppIntent to a control widget, but I'm guessing it's something like this: @available(iOS 18.0, *) struct OpenFeatureControl : ControlWidget { var body: some ControlWidgetConfiguration { StaticControlConfiguration(kind: "com.example.OpenFeature") { ControlWidgetButton(action: LaunchAppIntent()) { Image(systemName: "book") } } .displayName("Launch Feature") } } But there's one critical piece missing here: how is the target feature actually opened? My initial assumption would have been that once the app launches or resumes, there's a call to some method like continueUserActivity that has a user-info dict with some key whose value is the LaunchAppEnum. But I've put breakpoints on all those methods in my app and none of them get called (I'm using UIKit scene lifecycle). I also tried a regular AppIntent with a perform method that talks to my app directly: @available(iOS 18.0, *) struct OpenFeatureIntent : AppIntent { static let title: LocalizedStringResource = "Open My Feature" static let opensAppWhenRun: Bool = true init() {} func perform() async throws -> some IntentResult { //MAIN_APP is defined in Active Compilation Conditions in build settings #if MAIN_APP let url = URL(string: "myapp://openfeature")! UrlHandler.instance().handle(url) #endif return .result() } } But when run, this simply does nothing. Launching an app directly to a particular view or feature seems like a common use-case for control widgets, and there are apps doing it, but I can't find an example of how it's supposed to work. And the docs are really not helpful. Can anyone provide the missing piece here? What's the expected plumbing in an OpenIntent that actually launches particular UI in the app?
3
1
671
Sep ’24
How can you use ContactAccessButton() or contactAccessPicker() with a storyboard?
I've got an existing app using storyboards and would like to incorporate the new iOS 18 ContactAccessButton() and contactAccessPicker() into the GUI. However, how can that be done? If I try to do something like add a UIView to a view controller in the storyboard, then ContactAccessButton can't be assigned to it (even though ContactAccessButton inherits from UIView). Nor can a ContactAccessButton be used as a type within the Storyboard/the View Controller. How do I go about integrating this new iOS feature into an existing app using Storyboards and view controllers?
2
0
276
Sep ’24
Scene Delegate Migration Lifecycle
We are in the process of migrating our application to SceneDelegate. We currently check in a variety of places if the app is running in the background for analytics reasons. The app may be running in the background due to location updates, notifications being received, or background refresh. With scene delegate, the app starts in the background state and only becomes active once a scene has connected. We have been unable to find a way if an app is truly running in the background or if a scene delegate is about to be launched.
2
0
204
Sep ’24
Syntax Highlighting with TextKit 2
Based on this TextKit 2 demo project I thought that I could implement syntax highlighting by parsing syntax block tokens (e.g. comments like <!-- --> or /* */) in processEditing and storing their locations, and then actually applying the rendering with NSTextContentStorageDelegate in textContentStorage(_:textParagraphWith:) by checking the location of each paragraph against the store of syntax tokens. This sort of works except that the rendering is only updated for paragraphs which are changed. Is there a way to trigger NSTextContentStorage to re-fetch paragraphs in a given range? Or is this a totally misguided approach to the problem?
1
0
296
Sep ’24
[Need help ASAP] UIKit - TabbarController - Tabbar is behind selected VC's view with Xcode16 RC + iOS18 RC combo, but the rest combo are just fine
So we are testing our app code base with Xcode16 and fix any compile errors. After it builds and run, we found our tar bar controller's tar bar is behind the selected VC's view. We thought it is our bug, but we have tested below combo: Xcode15 + iOS18 - Fine we are invited to your office to test the new iPhone 16 series, they are iOS18, and our app on the app store is totally fine (built with Xcode 15) Xcode15 + iOS < 18 - Fine Apparentely ok, it's shipped. Xcode16 RC + iOS 17 device - Fine it's also fine Xcode16 RC + iOS18 RC: tar bar is behind selected VC because we are not able to add iPhone 16 model to our account, we flushed our in-house device to iOS18 RC to test Xcode16 built app, The tar bar is behind the selected VC. We want to ask for help ASAP because we are totally out of mind what's going on. I have filed FB 15120641 but want to raise it here to gain more support and insights.
2
1
263
Sep ’24
How to make iPad app move to display show full-screen and center align
I wrote an app that can show live streaming. When using iPad, I can connect an external display and move app to display, that I can do what I want on my iPad and watch live streaming on external display using cable. But app moving to display is not always full screen, and on some displays it shows larger than the external display range that I should go to Settings -> Display & Brightness -> External Display -> Switching "Allow Display Mode Changes" to fix this issue. Are there APIs to make the App "move to display" programmatically, keep app full-screen, matching the external display's resolution on the External display?
2
0
338
Sep ’24
Xcode 16 RC iPhone16 ProMax simulator status bar height is wrong
I am using Xcode 16 RC to debug an iPhone 16 app. The status bar height returned by iPhone 16 and iPhone 16 Pro is 54, while the height of the status bar returned by iPhone 16 ProMax is 44. Why is this? Here is the code I use: [UIApplication sharedApplication].windows.firstObject.windowScene.statusBarManager.statusBarFrame.size.height
1
0
497
Sep ’24
UIApplication.shared.open iOS 18
Making the call as: UIApplication.shared.open(websiteURL) doesn't open the browser and gives the following in the console: BUG IN CLIENT OF UIKIT: The caller of UIApplication.openURL(:) needs to migrate to the non-deprecated UIApplication.open(:options:completionHandler:). Force returning false (NO). However, making the call as: UIApplication.shared.open(websiteURL) { _ in } opens the browser and there is nothing in the cosole. Does someone understand why is this or if it's Apple's iOS 18 bug? In the iOS & iPadOS 18 RC Release Notes | Apple Developer Documentation there is a section around resolving this or something similar, unsure.
9
5
4.5k
Sep ’24