Post not yet marked as solved
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?
Post not yet marked as solved
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?
Post not yet marked as solved
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?
Post not yet marked as solved
With the announcement of the new Apple Translate app and offline support, are there any URL schemes that we can use in our apps to send text to the Translate app and have it open and translate the sent text?
Post not yet marked as solved
I have an MKMapView that has a MKTileOverlay so that I can show Open Street Map tiles:NSString *templateURL = @"http://tile.openstreetmap.org/{z}/{x}/{y}.png";
self.tileOverlay = [[MKTileOverlay alloc] initWithURLTemplate:templateURL];
self.tileOverlay.canReplaceMapContent = YES;
[self.mapView addOverlay:self.tileOverlay level:MKOverlayLevelAboveLabels];I also want to show an MKPolyline from my current location to Apple Park in Cupertino. This polyline needs to be updated as I move, and since an MKPolyline object isn't mutable, I have to remove it and add it for each location update:- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray*)locations {
self.currentLocation = userLocation;
// Update polyline
CLLocationCoordinate2D applePark = CLLocationCoordinate2DMake(37.334626, -122.008895);
[self buildPolylineWithDestinationLocation:applePark];
}
- (void)buildPolylineWithDestinationLocation:(CLLocationCoordinate2D)coordinate {
// Remove the polyline each time so we can redraw it
if (self.polylineApple) {
[self.mapView removeOverlay:self.polylineApple];
}
// Get current location
CLLocation *location = self.currentLocation;
CLLocationCoordinate2D currentLocation = location.coordinate;
CLLocationCoordinate2D points[2];
points[0] = currentLocation;
points[1] = coordinate;
// Remove all route polylines
MKPolyline *oldPolyline = self.polylineApple;
// Draw a line
self.polylineApple = [MKPolyline polylineWithCoordinates:points count:2];
[self.mapView addOverlay:self.polylineApple];
if (oldPolyline) {
[self.mapView removeOverlay:oldPolyline];
oldPolyline = nil;
}
}The problem is, this used to work great in older versions of iOS, but ever since iOS 13 this has caused the tiles to be redrawn each time that MKPolyline is removed and added. See:https://i.stack.imgur.com/9nJEO.gifIs this just an iOS 13 bug, or is there something I need to fix in my code to make this not happen?
Post not yet marked as solved
This issue has occurred in Xcode 11 and we didn't find it until users reported it. It seems that if you have a Static Table View that is grouped, the textLabel.text is not being replaced with the localized text. This was working in Xcode 10. See: https://stackoverflow.com/questions/57905965/xcode-11-ios-13-localization-issueThis is a MAJOR issue since how large parts of our app are not localized when they used to be in previous Xcode versions.This happens when the app has been built with Xcode 11 and iOS 13 as the base SDK.Has something changed? Is there a new setting we need to check?