Objective-C

RSS for tag

Objective-C is a programming language for writing iOS, iPad OS, and macOS apps.

Posts under Objective-C tag

199 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

How to store the userdata in system keychain instead of Default keychains
I need to store some data of my application in system keychain which should to accessible to all the users in the system. Here is the below sample code : // Create a SecAccessControlRef for a keychain item with access control SecAccessControlRef accessControl = SecAccessControlCreateWithFlags( kCFAllocatorDefault, kSecAttrAccessibleWhenUnlocked, kSecAccessControlUserPresence, NULL ); // Define a query dictionary for a keychain item NSDictionary *query = @{ (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword, (__bridge id)kSecAttrService: @"MyService", (__bridge id)kSecAttrAccount: @"MyAccount", (__bridge id)kSecValueData: [@"MyPassword" dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecAttrAccessControl: (__bridge_transfer id)accessControl, }; // Add the keychain item to the default keychain (login keychain) OSStatus status = SecItemAdd((__bridge CFDictionaryRef)query, NULL); if (status != errSecSuccess) { NSLog(@"Error adding keychain item: %d", (int)status); } I tried using SecKeychainOpen to access the system keychain but SecKeychainOpen is deprecated and I could not find any equivalent latest API to support that. SecKeychainRef systemKeychain; OSStatus status = SecKeychainOpen("/Library/Keychains/System.keychain", &systemKeychain); if (status != errSecSuccess) { NSLog(@"Error opening system keychain: %d", status); } else { SecAccessControlRef accessControl = SecAccessControlCreateWithFlags( kCFAllocatorDefault, kSecAttrAccessibleWhenUnlocked, kSecAccessControlUserPresence, NULL ); NSDictionary *query = @{ (__bridge id)kSecClass: (__bridge id)kSecClassGenericPassword, (__bridge id)kSecAttrService: @"MyService", (__bridge id)kSecAttrAccount: @"MyAccount", (__bridge id)kSecValueData: [@"MyPassword" dataUsingEncoding:NSUTF8StringEncoding], (__bridge id)kSecUseKeychain: (__bridge id)systemKeychain, (__bridge id)kSecAttrAccessControl: (__bridge_transfer id)accessControl, }; // Add the keychain item to the system keychain status = SecItemAdd((__bridge CFDictionaryRef)query, NULL); if (status != errSecSuccess) { NSLog(@"Error adding keychain item to system keychain: %d", (int)status); } if (systemKeychain) { CFRelease(systemKeychain); } } ANY suggestions will be helpful, Please help!
3
0
549
Oct ’23
iOS17, _UIGraphicsBeginImageContextWithOptions crash, how should solve?
Incident Identifier: C7E20EA3-7315-404A-83D5-8DBD20F8406B Hardware Model: iPad13,1 Process: 月儿记账 [352] Path: /private/var/containers/Bundle/Application/1F4F62A3-A990-4094-9982-DB0CFBB82662/月儿记账.app/月儿记账 Identifier: top.bytearts.money Version: 1.6.0 (000194) AppStoreTools: 15A240a AppVariant: 1:iPad13,1:15 Code Type: ARM-64 (Native) Role: Foreground Parent Process: launchd [1] Coalition: top.bytearts.money [491] Date/Time: 2023-09-28 00:34:09.5371 +0800 Launch Time: 2023-09-28 00:34:03.1161 +0800 OS Version: iPhone OS 17.0 (21A329) Release Type: User Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: SIGNAL 6 Abort trap: 6 Terminating Process: 月儿记账 [352] Triggered by Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x19862a5e0 __exceptionPreprocess + 164 (NSException.m:249) 1 libobjc.A.dylib 0x1909abc00 objc_exception_throw + 60 (objc-exception.mm:356) 2 Foundation 0x197b944d4 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 172 (NSException.m:261) 3 UIKitCore 0x19a844904 _UIGraphicsBeginImageContextWithOptions + 568 (UIGraphics.m:407) 4 UIKitCore 0x19a8428d0 -[UIImageView(Pretiling) _updatePretiledImageCacheForImage:] + 812 (UIImageView_Pretiling.m:171) 5 UIKitCore 0x19a7920b0 -[UIImageView _updateImageViewForOldImage:newImage:] + 496 (UIImageView.m:3604) 6 UIKitCore 0x19a75c0fc -[UIImageView _resolveImagesWithPreviouslyDisplayedImage:] + 836 (UIImageView.m:3409) 7 UIKitCore 0x19a75bd74 -[UIImageView _setImage:invalidatingPendingSymbolTransitions:] + 280 (UIImageView.m:1379) 8 UIKitCore 0x19a7c1ab0 -[UIButtonLegacyVisualProvider _updateBackgroundImageView] + 124 (UIButtonLegacyVisualProvider.m:1795) 9 UIKitCore 0x19a7c02c4 -[UIButtonLegacyVisualProvider layoutSubviews] + 100 (UIButtonLegacyVisualProvider.m:2379) 10 UIKitCore 0x19a7c021c -[UIButton layoutSubviews] + 40 (UIButton.m:2811) 11 UIKitCore 0x19a7831d8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1528 (UIView.m:19754) 12 QuartzCore 0x199b9b888 CA::Layer::layout_if_needed(CA::Transaction*) + 500 (CALayer.mm:10783) 13 QuartzCore 0x199b9b410 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 144 (CALayer.mm:2594) 14 QuartzCore 0x199ba194c CA::Context::commit_transaction(CA::Transaction*, double, double*) + 464 (CAContextInternal.mm:2792) 15 QuartzCore 0x199b9ac3c CA::Transaction::commit() + 648 (CATransactionInternal.mm:432) 16 QuartzCore 0x199b9a8e4 CA::Transaction::flush_as_runloop_observer(bool) + 88 (CATransactionInternal.mm:942) 17 CoreFoundation 0x1985731dc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36 (CFRunLoop.c:1789) 18 CoreFoundation 0x198571be4 __CFRunLoopDoObservers + 548 (CFRunLoop.c:1902) 19 CoreFoundation 0x198571300 __CFRunLoopRun + 1028 (CFRunLoop.c:2983) 20 CoreFoundation 0x198570e18 CFRunLoopRunSpecific + 608 (CFRunLoop.c:3420) 21 GraphicsServices 0x1db02d5ec GSEventRunModal + 164 (GSEvent.c:2196) 22 UIKitCore 0x19a97f350 -[UIApplication _run] + 888 (UIApplication.m:3690) 23 UIKitCore 0x19a97e98c UIApplicationMain + 340 (UIApplication.m:5275) 24 月儿记账 0x10067cfcc main + 68 (main.m:18) 25 dyld 0x1bad53d44 start + 2104 (dyldMain.cpp:1269)
3
1
820
Oct ’23
Using VoiceOver's accessibilityCustomActions and supporting Voice Control for the group subviews
Hi, My app supports VoiceOver and VoiceControl, and I find it hard or perhaps even impossible to support both when it comes to grouping accessibility elements. I have an element containing multiple subviews, and I want to define it as a group of accessibility custom actions to enhance VoiceOver navigation. (So that the user can focus on the entire element, and just swipe up or down if they want to activate one of its subviews as a custom action). To do that, I'm setting isAccessibilityElement to YES and I'm using accessibilityCustomActions where I create a custom action for each of this element's subviews. This works fine and presents the accessibility custom actions as expected. The struggle comes when I try to combine it with Voice Control. Since the element contains multiple subviews, I want each of these subviews to be accessible when using Voice Control with item numbers, for example. Instead, Voice Control is setting a number only on the entire element, ignoring its subviews. This is not functional because each of these subviews performs a different action when activating it. I found that VoiceControl is only numbering subviews when the parent's isAccessibilityElement is set to NO. And indeed, when changing to NO, the subviews are getting numbered, but the custom actions group break, and VoiceOver treats each element as a separate accessibility element. So I can't use accessibilityCustomActions AND supporting VoiceControl. Is this an intended behavior defined by Apple? Or, is there anyway I can support them both?
0
0
403
Oct ’23
'kUTTypeJPEG' is deprecated: first deprecated in macOS 12.0 - Use UTTypeJPEG
Updating to MacOS 12, in Objective C, I get the above warning regarding changing kUTTypeJPEG to UTTypeJPEG in two places The old code still works but even after the @import UniformTypeIdentifiers changing kUTTypeJPEG to UTTypeJPEG with various types, e.g. CFString, CFStringRef, and that UTTYPE doesn't bridge???, etc. (I am obviously clueless about this) I get the compiler warnings to go away but then the program crashes. How do I fix these? Something to do with ARC or bridging??? CGImageDestinationRef destinationRef = CGImageDestinationCreateWithURL((__bridge CFURLRef)theURL, (NSString *)kUTTypeJPEG, 1, NULL); NSDictionary *imageSourceCreationOptions = [NSDictionary dictionaryWithObjectsAndKeys: kUTTypeJPEG,(NSString *)kCGImageSourceTypeIdentifierHint, (NSNumber *)kCFBooleanTrue, (NSString *)kCGImageSourceShouldCache, (NSNumber *)kCFBooleanTrue, (NSString *)kCGImageSourceShouldAllowFloat, nil];
2
0
839
Oct ’23
Is there a way to determine if the mouse and cursor are currently dissociated using CGAssociateMouseAndMouseCursorPosition?
This status is essential for generating simulated CGEvents. Games often use this API to implement cursor lock. If we send CGEvents with a moving position, it's possible for the cursor to move outside the game window and cause the game window to become inactive. If we don't send CGEvents with updated positions, we can only control the mouse within the game but not in other windows or the desktop.
0
0
424
Oct ’23
NSRunningApplication activateWithOptions does not work on Sonoma
Hello, Our application uses following code to activate itself: void BecomeFrontMostApp() { @autoreleasepool { if ([NSApp isActive] == YES) return; [[NSRunningApplication currentApplication] activateWithOptions: NSApplicationActivateIgnoringOtherApps | NSApplicationActivateAllWindows ]; } } Code works on Ventura and previous OS versions but not on Sonoma. On Sonoma application does not come to foreground but instead dock icon starts jumping same way when calling: [NSApp requestUserAttention: NSCriticalRequest]; And activateWithOptions returns false. I checked activationPolicy on the app running on Sonoma - it is NSApplicationActivationPolicyRegular Any ideas how to fix this appreciated.
2
0
536
Oct ’23
Does URLByResolvingBookmarkData consume any resources on iOS?
My app saves the file URLs obtained from UIDocumentPickerViewController as bookmark data and reads them on the "history screen". In the "history screen", whenever viewWillAppear is called in ViewController, URLByResolveBookmarkData is called for all bookmarks to check if the file has been deleted or moved. (Please see code below) - (void)refresh { NSManagedObjectContext* context = self.managedObjectContext; // read all bookmarks NSArray<HistoryItem*>* all = [self histories]; [all enumerateObjectsUsingBlock:^(HistoryItem * _Nonnull item, NSUInteger idx, BOOL * _Nonnull stop) { BOOL isStale; NSURL* url = [NSURL URLByResolvingBookmarkData: item.bookmark options: 0 relativeToURL: nil bookmarkDataIsStale: &isStale error: nil]; if(url == nil) { // file is deleted [context deleteObject: item]; } else { item.filename = url.lastPathComponent; if(isStale) { // file is moved NSData *data = [url bookmarkDataWithOptions: 0 includingResourceValuesForKeys: 0 relativeToURL: nil error: nil]; if(data != nil) { item.bookmark = data; } } } }]; [context save: nil]; } Then, after many calls to viewWillAppear, calling startAccessingSecurityScopedResource on the URL obtained by URLByResolvingBookmarkData returns NO. I suspect that URLByResolveBookmarkData is consuming some resources, because the problem reproduces even if I change the code inside the block to only call URLByResolveBookmarkData, and it doesn't reproduce when I empty the block. Does URLByResolvingBookmarkData consume any resources? If so, how do I release the consumed resources? OS: iOS 15 Xcode: 15.0
3
0
371
Oct ’23
macOS: WiFi security type on Sonoma
In the context of a system utility that reports OS stats periodically, the security type for a connected WiFi network could be obtained with Core WLAN via CWInterface.security. This used to work up to Ventur; howver, after upgrading to Sonoma, cwInterface.security now returns kCWSecurityUnknown. In other posts, I have read about changes in how Core WLAN works which are related to Sonoma. How can I determine the security type for a connected WiFi network on Sonoma? It would be preferable if the suggested approach would also work on previous macOS versions as well. Many thanks in advance! :-)
2
0
1k
Mar ’24
Mouse events on popup menu view seem to be incorrect in Sonoma.
as I open the pop-up menu and move the mouse before that opened, MouseEntered Event and MouseExited Event are called when mouse moved. The following trackingAreas options are inclued in the view in pop-up area. NSTrackingInVisibleRect, NSTrackingMouseEnteredAndExited, NSTrackingMouseMoved, NSTrackingActiveInKeyWindow LocationInWindow of MouseExitedEvent seem to be incorrect. This problems does not occur in the following cases. Do not move the mouse until the popup is fully opened. Left mouse button down on pop-up area. Move the mouse out of the pop-up area. This issue occurs in Sonoma(MacOS14.0) and later. I would like to know if this is a code issue or a bug in the OS Version. AppDelegate.h #import <Cocoa/Cocoa.h> @interface ViewInPopup : NSView { NSString* resultStr; NSUInteger enteredCount; NSPoint lastEnteredPos; NSUInteger exitedCount; NSPoint lastExitedPos; NSUInteger movedCount; NSPoint lastMovedPos; NSTrackingArea* trackingArea; } @end @interface AppDelegate : NSObject <NSApplicationDelegate> { NSMenu* myMenu; ViewInPopup* viewInPopup; } - (IBAction)onClickButton:(id)sender; @end AppDelegate.mm #import "AppDelegate.h" @interface ViewInPopup () - (void)showResult:(NSEvent*)event; @end @implementation ViewInPopup - (id)initWithFrame:(NSRect)frameRect { self = [super initWithFrame:frameRect]; [self setWantsLayer:TRUE]; [[self layer] setBackgroundColor:[NSColor redColor].CGColor]; return self; } - (void)drawRect:(NSRect)dirtyRect { [super drawRect:dirtyRect]; [resultStr drawInRect:[self bounds] withAttributes:nil]; } - (void)updateTrackingAreas { if (trackingArea) { [self removeTrackingArea:trackingArea]; } NSTrackingAreaOptions options = NSTrackingInVisibleRect | NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveInKeyWindow; trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds] options:options owner:self userInfo:nil]; [self addTrackingArea:trackingArea]; [super updateTrackingAreas]; } - (void)mouseEntered:(NSEvent *)event { [self showResult:event]; [super mouseEntered:event]; } - (void)mouseExited:(NSEvent *)event { [self showResult:event]; [super mouseExited:event]; } - (void)mouseMoved:(NSEvent *)event { [self showResult:event]; [super mouseMoved:event]; } - (void)showResult:(NSEvent*)event { NSString* eventTypeStr = @""; switch (event.type) { case NSEventTypeMouseEntered: eventTypeStr = @"Entered"; [[self layer] setBackgroundColor:[NSColor redColor].CGColor]; if (enteredCount >= NSUIntegerMax) { enteredCount = 0; } else { enteredCount++; } lastEnteredPos = event.locationInWindow; break; case NSEventTypeMouseExited: eventTypeStr = @"Exited"; [[self layer] setBackgroundColor:[NSColor blueColor].CGColor]; if (exitedCount >= NSUIntegerMax) { exitedCount = 0; } else { exitedCount++; } lastExitedPos = event.locationInWindow; break; case NSEventTypeMouseMoved: eventTypeStr = @"Moved"; [[self layer] setBackgroundColor:[NSColor greenColor].CGColor]; if (movedCount >= NSUIntegerMax) { movedCount = 0; } else { movedCount++; } lastMovedPos = event.locationInWindow; break; default: return; } resultStr = [NSString stringWithFormat:@"LastEventType:%@\n\nEnteredCount:%ld\nLastEnteredPosition:(%f, %f)\n\nExitedCount:%ld\nLastExitedPosition:(%f %f)\n\nMovedCount:%ld\nLastMovedPosition:(%f, %f)", eventTypeStr, enteredCount, lastEnteredPos.x, lastEnteredPos.y, exitedCount, lastExitedPos.x, lastExitedPos.y, movedCount, lastMovedPos.x, lastMovedPos.y]; [self setNeedsDisplay:YES]; } @end @interface AppDelegate () @property (strong) IBOutlet NSWindow *window; @end @implementation AppDelegate - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application myMenu = [[NSMenu alloc] init]; NSMenuItem* item = [[NSMenuItem alloc] init]; [myMenu addItem:item]; viewInPopup = [[ViewInPopup alloc] initWithFrame:NSMakeRect(0, 0, 300, 300)]; [item setView:viewInPopup]; } - (void)applicationWillTerminate:(NSNotification *)aNotification { // Insert code here to tear down your application } - (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app { return YES; } - (IBAction)onClickButton:(id)sender { [myMenu popUpMenuPositioningItem:nil atLocation:NSZeroPoint inView:(NSView*)sender]; } @end
2
1
964
Mar ’24
Getting Error on iOS 17 for NSInternalInconsistencyException
In iOS 17 Im getting following error : Alert NSInternalinconsistencyException-UlViewController is missing its initial trait collection populated during initialization. This is a serious bug, likely caused by accessing properties or methods on the view controller before calling a UlViewController initializer. View controller: <HamburgerMenuViewController: 0x11307de00> It works on 16.7.1. It is a blocker in iOS 17
1
0
787
Oct ’23
UIImageView not working on iOS 17
I am developing an mobile application on objective C. I use UIImageView a lot to display several images on my app. It works fine up to iOS 16. Starting on iOS 17 both on a real iPhone and on the simulators the images don't show. It is like UIImageView does not load the images on iOS17. Is there anything new on iOS17 regarding how to use UIImageView?
5
1
990
Nov ’23
iOS 12 NSInternalInconsistencyException An -observeValueForKeyPath:ofObject:change:context: message was received but not handled Crash
Hi, The latest version of my app has a lot of comments about An -observeValueForKeyPath:ofObject:change:context: message was received but not handled crashes.However, the codes that caused the crash have not been changed in this version. Crash log 0: NSInternalInconsistencyException <CTRun: 0x1147bfd90>{string range = (8, 1), string = "\u7BEE", attributes = <CFBasicHash 0x280356480 [0x20dd53a30]>{type = mutable dict, count = 3, entries => 0 : <CFString 0x20e455978 [0x20dd53a30]>{contents = "NSFont"} = <CTFont: 0x1147550a0>{name = PingFangSC-Regular, size = 27.000000, matrix = 0x0, descriptor = <CTFontDescriptor: 0x283c31ce0>{attributes = <CFBasicHash 0x280225cc0 [0x20dd53a30]>{type = mutable dict, count = 1, entries => 2 : <CFString 0x20e45bc38 [0x20dd53a30]>{contents = "NSFontNameAttribute"} = <CFString 0x281730060 [0x20dd53a30]>{contents = "PingFangSC-Regular"} } >}} 1 : <CFString 0x20ef906b0 [0x20dd53a30]>{contents = "NSParagraphStyle"} = <CTParagraphStyle: 0x28332e370>{base writing direction = -1, alignment = 0, line break mode = 0, default tab interval = 0 first line head indent = 0, head indent = 0, tail indent = 0 line height multiple = 0, maximum line height = 0, minimum line height = 0 line spacing adjustment = 0, paragraph spacing = 0, paragraph spacing before = 0 maximum li...too long be cutted! 0 CoreFoundation ___exceptionPreprocess + 232 14 UIKitCore -[UIViewController loadView] + 256 15 *** -[SNThemeViewController loadView] (SNThemeViewController.m:52) Log1 NSInternalInconsistencyException <CTFont: 0x118a0f7a0>{name = .PingFangSC-Regular, size = 19.000000, matrix = 0x0, descriptor = <CTFontDescriptor: 0x282b5c1e0>{attributes = <CFBasicHash 0x281427000 [0x21b4a9430]>{type = mutable dict, count = 1, entries => 2 : <CFString 0x21bb98888 [0x21b4a9430]>{contents = "NSFontNameAttribute"} = <CFString 0x21bb87408 [0x21b4a9430]>{contents = ".PingFangSC-Regular"} } >}}: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled. Key path: position Observed object: <CALayer: 0x280e5e4c0> Change: { kind = 1; new = "NSPoint: {207, 0.5}"; } Context: 0x0 0 CoreFoundation ___exceptionPreprocess + 228 12 UIKitCore -[UITableViewHeaderFooterView layoutSubviews] + 84 13 *** -[SNCommentCellFooter layoutSubviews] (SNCommentCellFooter.m:63) Log2 NSInternalInconsistencyException <NWConcrete_nw_endpoint_flow: 0x10908f400>: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled. Key path: contentOffset Observed object: <UITableView: 0x1088b9a00; frame = (0 0; 428 799); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x28338cff0>; backgroundColor = UIExtendedGrayColorSpace 0 0; layer = <CALayer: 0x283d1d5a0>; contentOffset: {0, 21781.666666666668}; contentSize: {428, 24466}; adjustedContentInset: {0, 0, 156, 0}; dataSource: <SNNewsPageTableDataSource: 0x281e0b250>> Change: { kind = 1; new = "NSPoint: {0, 21781.666666666668}"; } Context: 0x0 0 CoreFoundation ___exceptionPreprocess + 164 21 UIKitCore _UIApplicationMain + 340 22 *** main (main.m:15) Log3 NSInternalInconsistencyException <UILongPressGestureRecognizer: 0x135b942f0; state = Possible; view = <UITableViewCellContentView 0x135b81f00>; target= <(action=_longPressGestureRecognized:, target=<UITableViewCell 0x136a23200>)>>: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled. Key path: position Observed object: <CALayer: 0x281bf6180> Change: { kind = 1; new = "NSPoint: {19, 19}"; } Context: 0x0 0 CoreFoundation ___exceptionPreprocess + 228 12 UIKitCore -[UIImageView _setViewGeometry:forMetric:] + 172 13 *** -[SNLikeAnimationButton layoutSubviews] (SNLikeAnimationButton.m:142) and so on... I don’t know how to locate it now. Please help me locate the problem. I look forward to your reply. If you need more information please let me know
0
0
376
Nov ’23
Showing "Unable To Install" alert
This is enterprise application and we distribute using TestFairy for testing. Today when we upload IPA file to TestFairy and downloaded app in iPad, we are getting error showing "Unable To Install" Please try again later after installation finish. Attached screenshot for reference. This app is in Objective C. Previous versions uploaded on TestFairy working fine and able to install.
1
0
561
Nov ’23
Setting UIViewController preferredContentSize is broken in iOS 17
In iOS 17, I am having an issue where UIPopoverPresentationControllers are not retaining the preferred size of the UIViewController they contain. The following method uses a UIPopoverPresentationController popoverVC to display a UIViewController contentVC from a UIView view anchor location frame. + (void) showDialogiPad:(UIViewController *)contentVC fromPresentingVC:(UIViewController *)presentingVC inView:(UIView *)view atFrame:(CGRect)frame withDirection:(UIPopoverArrowDirection)direction { // Set content view controller size contentVC.preferredContentSize = contentVC.view.frame.size; // Choose the presentation style in which the content is // displayed in a popover view contentVC.modalPresentationStyle = UIModalPresentationPopover; // Get a popover presentation controller UIPopoverPresentationController *popoverVC = contentVC.popoverPresentationController; // Set the popover size and anchor location contentVC.popoverPresentationController.sourceRect = frame; contentVC.popoverPresentationController.sourceView = view; // Set the arrow direction for the popover popoverVC.permittedArrowDirections = direction; // Present the popover presentation controller [presentingVC presentViewController:contentVC animated:YES completion:nil]; } Prior to iOS 17, the code displayed the popover as expected as shown here: The issue now however is since the update to iOS 17, the popover is now squashed and displayed as: A few observations: The popover dialog actually displays properly the first time you open it. Every subsequent time you open it, it is squashed. When I comment out the line that sets the preferredContentSize, the popover opens at the max size every time - so it shows all the content but it is not set to the size I want it to be. If I leave preferredContentSize as is but change modalPresentationStyle to UIModalPresentationFormSheet, the size of the popover is correct but the popover always presents in the middle of the screen.
1
0
629
Nov ’23
After my project is built using Xcode 15 it crashes wherever I have created cpp instance using "new" in OS 11 with arm processor systems.
I am building a project which has swift, cpp and objective - c files. Till now the app was working fine. But now Since the app is built using the newer Xcode version ie Xcode 15, the app is crashing in the BigSur( MacOS 11) using arm64 processor. It works fine in all other OS including OS 11 with x86_64 processor. When I checked the reason for the crash, the crash report points at the place where we created cpp instances in objective c file. My code is as follows _deviceList = new AudioDeviceList(false); // AudioDeviceList is the cpp class and I am creating instance for this in Objective c file mBassTrebleLevelLeft = new BassTreble(512); // BassTreble is the cpp class and I am creating instance for this in Objective c file The crash points at these lines. Can anyone please help me why there is issue with Xcode 15 on creation of cpp instance?
2
0
801
Nov ’23