Post

Replies

Boosts

Views

Activity

Swift Package with @objc cannot find interface declaration
I am using a Swift PM module and adding it to a brand new project. This project is Objective-C based, but I would like to use the module within a .swift file as I am working to migrate part of my project to Swift. The .swift file is called from the Objective-C app delegate. When doing this method on a brand new project, it builds correctly. However, when I add the module to my production app (has been in development for 10 years) in the same way, I get the following error in my MyApp-Swift.h file: Cannot find interface declaration for 'MBNavigationViewController', superclass of 'CarPlayMapViewController'; did you mean 'UINavigationController'? I have even created a stripped down version of my app with minimal files and it still does not build. There must be some build setting or something else that allows the module to work in a brand new project (accessing the MyApp-Swift.h file that generates the Obj-C methods) but not in my older project?
1
0
942
Jul ’24
State Restoration: Deleting current state data
In the past, it seemed that if you used the app switcher and killed the app, that state restoration data would not persist, and starting the app again would not load any stored state data. But now (at lest in iOS 17) that is no longer the case. There are situations where the old state might cause issues, which we obviously need to fix, but users should be able to clear the state data. I am not using sessions and am using the older methods - application:shouldSaveApplicationState: and application:shouldRestoreApplicationState:. My question is, how can I tell my users to reset/clear state restoration data if needed?
0
0
469
Jun ’24
Driving Task Crash When Adding Action Sheet or Alert
I have a driving task app and am trying to show a CPActionSheetTemplate or a CPAlertTemplate. Both of these are crashing showing: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unsupported object <CPActionSheetTemplate: 0x6000030319e0> <identifier: C744031B-99F6-4999-AF19-6ED43140502B, userInfo: (null), tabTitle: (null), tabImage: (null), showsTabBadge: 0> passed to pushTemplate:animated:completion:. Allowed classes: {( CPSearchTemplate, CPNowPlayingTemplate, CPPointOfInterestTemplate, CPListTemplate, CPInformationTemplate, CPContactTemplate, CPGridTemplate, CPMapTemplate )}' This is very strange, because in the docs all app types are allowed to show ActionSheets and Alerts. Why is this crashing?
1
0
852
Jan ’24
iOS 15 change in MKTileOverlay and tileSize?
In our iOS app we use a MKTileOverlay subclass and set tileSize to CGSizeMake(512, 512). This allows tiled maps such as Open Street Maps to display larger for those that need larger font sizes. Since iOS 15 this no longer works, and the tiles are not large anymore and are small, similar to how it was before we added this feature. Once tileSize has been set, we use loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *, NSError *))result to return the larger image NSData in the result. Did something change in OS 15 and MKTileOverlay and tileSize that would require some changes on our end?
0
0
806
Sep ’21
Center on screen two annotations while allowing MKCamera heading updates creates very jerky animations
In my app, I have a mode that rotates the MKMapView camera heading based on Core Location heading updates. This works great. [UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{ self.mapView.camera.heading = theHeading;//Comes from CLHeading } completion:nil]; At the same time, I have two annotations, one is the current location, that I always want to keep on screen. So as the user gets closer to one of the annotations, the map will continue to zoom in. MKMapRect flyTo = MKMapRectNull; if (location) { MKMapPoint annotationPoint = MKMapPointForCoordinate(location.coordinate); MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0); if (MKMapRectIsNull(flyTo)) { flyTo = pointRect; } else { flyTo = MKMapRectUnion(flyTo, pointRect); } } if (CLLocationCoordinate2DIsValid(self.selectedCoordinate)) { MKMapPoint annotationPoint = MKMapPointForCoordinate(self.selectedCoordinate); MKMapRect pointRect = MKMapRectMake(annotationPoint.x, annotationPoint.y, 0, 0); if (MKMapRectIsNull(flyTo)) { flyTo = pointRect; } else { flyTo = MKMapRectUnion(flyTo, pointRect); } } [self.mapView setVisibleMapRect:flyTo edgePadding:UIEdgeInsetsMake(30, 30, 30, 30) animated:animated]; The Problem The big issue here, is that as the user rotates the device, and the heading is updated, the visibleMapRect is also updated to keep both annotations on the map. This causes the map to animate back to "north up" and then quickly back to rotating the map camera. This creates a very jerky movement which is not what I want. Is it possible to set the visibleMapRect and the camera heading at the same time without this negative side effect?
0
0
995
Apr ’21