Post

Replies

Boosts

Views

Activity

MapKit with MKTileOverlay Crashes After a Time
I'm building a weather map that shows the rain on the map. I'm able to retrieve PNG images that are used as tiles to put onto the map. I then reload all the tiles on the map with each timeframe (tile set for every 10 minutes). I'm able to get the map loaded up and I'm able to place the tiles and reload the data for each time slot. I preload all the PNG data needed for the tiles and store that NSData for them in memory so that they are quick for loading and showing on the map. I have timer's set to reload the overlay with the next set of tiles for each time slot. Giving the view of a moving precipitation map over time (just like you'd see on any weather map.) I have 12 time slots (timestamps) showing every 10 minutes for the past 2 hours. I have it showing each in sequence and then repeating. Over time I get a crash with this error as a Thread 1: signal SIGABRT. Failed to acquire drawable, rendering to temporary texture validateRenderPassDescriptor:782: failed assertion `RenderPass Descriptor Validation MTLRenderPassAttachmentDescriptor MTLStoreActionMultisampleResolve store action at attachment 0 requires resolve texture ' validateRenderPassDescriptor:782: failed assertion `RenderPass Descriptor Validation MTLRenderPassAttachmentDescriptor MTLStoreActionMultisampleResolve store action at attachment 0 requires resolve texture ' Through some searching I've discovered that this seems to be console output from Metal. I assume Metal is used for MapKit to render the overlay tiles? I'm using the same custom overlay where I set the timestamp on it and then tell it to reload. I also reuse the same MKOverlayRenderer as shown here... - (MKOverlayRenderer*)mapView:(MKMapView*)mapView rendererForOverlay:(id<MKOverlay>)overlay { if ([overlay isKindOfClass:[MKTileOverlay class]]) { if (!self.rainRenderer) { self.rainRenderer = [[MKTileOverlayRenderer alloc] initWithTileOverlay:overlay]; self.rainRenderer.alpha = 0.5; } return self.rainRenderer; } return nil; } And here's the function that reloads the overlay... - (void) updateRainFrame { self.currentFrameIndex = (self.currentFrameIndex + 1) % self.timestamps.count; if ((self.currentFrameIndex >= 0) && (self.timestamps.count > self.currentFrameIndex)) { NSLog (@"self.currentFrameIndex = %lu", self.currentFrameIndex); NSString *timestamp = self.timestamps[self.currentFrameIndex]; [self.overlay setTimestamp:timestamp]; [self.rainRenderer reloadData]; } } The time it takes to crash seems arbitrary. Sometimes it's very quick. Less than a minute. But usually it's several minutes. 10 or 20 minutes or more. Feels like some sort of race condition that's occurring. Perhaps ARC is not able to release the images for the tiles quick enough for each overlay reload? That's a wild guess but I think it's something more deeper in Metal as I feel I would see other errors related to memory availability. Some of my searches point to something about MSAA needing to be turned off in Metal to resolve this. However I have no idea how I would do that through MapKit. Any suggestions? Let me know if there is somehow a way to capture more from the crash to give more insight.
2
0
82
Jun ’25
"Compiler failed to build request" Spam when using MKTileOverlay
I'm building a weather map that shows the rain on the map. I'm able to retrieve PNG images that are used as tiles to put onto the map. I then reload all the tiles on the map with each timeframe (tile set for every 10 minutes). I'm able to get the map loaded up and I'm able to place the tiles and reload the data for each time slot. But I'm getting a ton of spam on the console every time the tiles are reloaded. Failed to locate resource named "sky20Grey0@2x.png" Failed to locate resource named "sky20Grey0@2x.png" Compiler failed to build request Compiler failed to build request Compiler failed to build request Compiler failed to build request Compiler failed to build request Compiler failed to build request Compiler failed to build request Compiler failed to build request Compiler failed to build request Yet the images are showing on the map just fine. But I feel like it's a bit sluggish due to all the spam coming out as I'm reloading this every 0.5 seconds with a timer. I've tried to load the data from a remote server on demand by overriding the - (void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *tileData, NSError *error))result function. But due to the timer this can lead to the data not getting loaded fully before it switches to the next time slot of data. I therefore pre-load everything. I can then store the NSData in memory and use loadTileAtPath or the NSURL to a stored file and use - (NSURL *)URLForTilePath:(MKTileOverlayPath)path. Both cases work. But both cases have this spam. I've further refined things such that the MKTileOverlayRenderer is reused but that didn't help. Here's the function for that.. - (MKOverlayRenderer*)mapView:(MKMapView*)mapView rendererForOverlay:(id<MKOverlay>)overlay { if ([overlay isKindOfClass:[MKTileOverlay class]]) { if (!self.rainRenderer) { self.rainRenderer = [[MKTileOverlayRenderer alloc] initWithTileOverlay:overlay]; self.rainRenderer.alpha = 0.5; } return self.rainRenderer; } return nil; } I'm using one MKOverlay and then just reloading the tiles as needed. Otherwise there is quite a pronounced flicker. Here's that function which is triggered by the NSTimer to happen every 0.5 seconds. - (void) updateRainFrame { self.currentFrameIndex = (self.currentFrameIndex + 1) % self.timestamps.count; if ((self.currentFrameIndex >= 0) && (self.timestamps.count > self.currentFrameIndex)) { NSLog (@"self.currentFrameIndex = %lu", self.currentFrameIndex); NSString *timestamp = self.timestamps[self.currentFrameIndex]; [self.overlay setTimestamp:timestamp]; [self.rainRenderer reloadData]; } } In that function I'm updating the "timestamp" in the overlay which is the time slot that contains all the tiles for that time. This way my overridden MKTileOverlay can then pass the correct path for the tiles. For example for loading from a file: - (NSURL *)URLForTilePath:(MKTileOverlayPath)path { return [self getWeatherTileFileURLForPath:path]; } Or NSData stored in memory - (void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *tileData, NSError *error))result { return [self getWeatherTileDataForPath:path]; } But no matter which way I use I keep getting this spam and unfortunately there is no error or anything to point to why it is spamming out. Also the tiles themselves are PNG files either 256x256 or 512x512 in pixel size. I saw that this could be something to do with Metal but I'm assuming that's something that MapKit uses. Very much welcome any thoughts to what could be causing this?
2
0
85
Jun ’25
Device with Number Already exists on this Team
I've created a new project in Xcode. I'm running the Xcode 16.4 and MacOS 15.5. I'm trying to run my barebones project on my iPhone 16 (I'm just getting started). I turned on developer mode on my iPhone and went through the whole process. But in the Signing & Capabilities of my project under status I see two errors... There is a problem with the request entity A device with number 'XXXX8801C' already exists on this team. Provisioning profile "iOS Team Provisioning Profile: [MyBundleID]" doesn't include the currently selected device "My iPhone" (identifier XXXX8801C). I noticed in the devices on the developer portal that my device is showing as "Processing." I feel ike it's stuck. But I can't figure out how to clear it all out and try again. It's been 24 hours since this error came up. I've tried to clear trusted computers on the iPhone. I've deleted the "Derived Data" folder. I've removed my developer account from Xcode and added it again. I've restarted both my Mac and my iPhone multiple times. I've noticed it asked to authorize my computer twice. When I clear the authorized computers and then plug the phone back in it asks twice again. So I'm not sure if this is the issue? No idea why it asks twice but I'm only ever able to respond to the second request as the first request gets blocked in the UI by the second requests if that makes sense? I'm also not able to turn off developer mode on my iPhone. The switch isn't there as the docs state it should be. So again, I feel like this is the phone and the developer portal stuck causing the problem. Note: I saw someone else had encountered this problem and I replied to it and boosted it. But it looks like it was posted in 2017? Hence this new post.
1
0
192
May ’25
Changing ViewControllers in ViewContainer Messing Up UIDatePicker
I'm changing view controllers programmatically which appears to work but the UIDatePickers in my view are not displaying correctly. Is there some sort of view update function I need to call? I'm changing views using the following code... [self addChildViewController:controller]; [self.viewContainer addSubview:controller.view]; [self.viewContainer bringSubviewToFront:controller.view]; controller.view.frame = self.viewContainer.bounds; This is called from the viewWillAppear call. This is what it looks like when I first bring up the view. And this is what it looks like when I turn the phone sideways and then back to portrait. It sorts itself out. I feel like I'm missing some calls. Any ideas?
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
445
Jan ’22
SearchBar in UISearchController Not Sizing
I have two issues here. The initial size of my searchbar in my UISearchController appears to be too wide when initially presented. The searchbar is not auto resizing if the orientation changes. Notice the right side how the search bar appears to extend beyond the edge... Then when I turn sideways I get the following (the UIView I'm using as a container I've painted purple. So I know it's resizing properly.. Just no the searchbar.) Here's how I'm adding it to my view... self.searchResultsController = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"SearchAddressTableView"]; self.searchController = [[UISearchController alloc] initWithSearchResultsController:self.searchResultsController]; self.searchController.searchResultsUpdater = self; self.searchController.searchBar.placeholder = @"Search Address or Place"; [self.searchController.searchBar sizeToFit]; [self.searchControllerContainerView addSubview:self.searchController.searchBar]; [self.searchController.searchBar setFrame:self.searchControllerContainerView.bounds]; [self.searchController.view setFrame:self.searchControllerContainerView.bounds]; [self.searchControllerContainerView bringSubviewToFront:self.searchController.searchBar]; [self.searchController.searchBar setNeedsUpdateConstraints]; [self.searchController.view setNeedsUpdateConstraints]; [self.searchController.searchBar sizeToFit]; self.searchController.delegate = self; self.searchController.obscuresBackgroundDuringPresentation = YES; self.searchController.searchBar.delegate = self; self.definesPresentationContext = YES; [super updateViewConstraints]; As you can see I've tried a number of different things with setting the bounds on not only the searchbar but also the controller's view as well. I also added this to see if it would help but unfortunately no change... - (void)viewWillLayoutSubviews { [self.searchController.searchBar sizeToFit]; } Any thoughts? I'm guessing it must have something to do with constraints. I just don't know how best to do that?
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
2.2k
Jan ’22
Autocomplete for System Imports Not Working
I'm using Objective C. When typing #import <... I don't get any sort of autocomplete. I want to import the MKMapKit, or whatever it is named, but I get no autocomplete. I would have assumed it would be something like #import <MKMapKit/MKMapKit.h>. I can search through the documentation for it but that's less productive. Not to mention the docs don't tell you the path usually. I've tried some things such as turning off code completion, restarting xCode, and then turning it back on. But no luck. Any other suggestions? I'm just guessing over time that with the various xCode updates I have on my system that something has gotten out of whack (just like my iCloud syncing between devices). Welcome any suggestions.
2
0
547
Jan ’22
Objective-C Syntax for a Block that has a Block as a Parameter?
I'm not sure this is even possible (and I'm sure there will be questions as to why) but I'm curious how one could define a block that takes a block as a parameter? For instance... MyFunctionWithSuccess:(void(^)((void(^)(NSString* value))blockAsParameter)success This of course doesn't work. The only thing I could find is on StackOverflow but I think in this case it returns a block. Regardless the syntax throws a compiler error.. StackOverflow - Syntax to define a Block that takes a Block and returns a Block in Objective-C There it says to define it as : void (^(^complexBlock)(void (^)(void)))(void) However this throws a "Type-id cannot have a name" which it complains about the ^complexBlock part. Again it just may be that this is not possible and bad to do. However I'd like to confirm that it is or isn't.
1
0
465
Dec ’21
CoreData NSPredicate with UUID FetchRequest Causes EXC_BAD_ACCESS (code 1)
I have an attribute called uuid that is of type UUID in my Core Data Entity. I'm then subsequently using an NSString representation to search for that UUID using an NSPredicate. Please note I'm using Objective C, not Swift here. When I use the following predicate everything works. NSString *uuid = @"fa96efec-7c33-463e-8ce9-a9463c469d24"; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"uuid == %@", [[NSUUID alloc] initWithUUIDString:uuid]]; However if I end up making a lot of calls this could be extremely memory intensive and seems like a wasted step creating an NSUUID each time... Everything I've found online states to do it this way... NSPredicate *predicate = [NSPredicate predicateWithFormat:@"uuid.UUIDString == [c] %@", uuid]; However this results in an EXC_BAD_ACCESS (code=1) crash. There is nothing in the log indicating why either. I just managed to track it down to the executeFetchRequest call with the predicate set. Which is the proper way of doing this without wasting memory creating NSUUIDs? I realize they are tiny but still, it seems like poor code.
0
0
685
Dec ’21
Pass swift func result to func
First off, I'm learning Swift still while working on my project and am not very good yet. I'm trying to pass the "result" variable from a func call to another function with some of my parameters... I'm also working with AWS's Amplify as you'll see here but that part is a bit irrelevant. The code before is like this... Amplify.API.get (request:request) { result in switch result What I would like to do is to pass that result to a func along with some other parameters.. Such as.. Amplify.API.get (request:request) { myFunction(result, myParam1, myParam2) } But Swift does things different than I'm used to with Objective-C. The definition for Amplify.API.get is... Amplify.API.get(request: RESTRequest, listener:((AmplifyOperation<RESTOperationRequest, Data, APIError>.OperationResult) -> Void) How do I setup my func so that it will take in what the get function is sending and handle it? Something like... func handleGet (request: RESTRequest, listener:((AmplifyOperation<RESTOperationRequest, Data, APIError>.OperationResult) -> Void, myParam1, myParam2) But then I don't know how to pass that to the get or call it within the code block?
5
0
929
Nov ’21
Xcode 13 with CocoaPods and XCBuildData folder
I've just created a new project when I do I commit I see the usual files as one would expect to be selected... Then I did a pod init, added a pod, and did a pod install. Now when I commit the XCBuildData folder shows up with a ton of files. Should I select each one and add them to my commit? Sounds dangerous for sharing with others? How do I ignore them? Example file names are... 1d091aeb1ef50b7e3f02bd78c72db716-buildRequest.json 1d091aeb1ef50b7e3f02bd78c72db716-desc.xcbuild 1d091aeb1ef50b7e3f02bd78c72db716-manifest.xcbuild 1d091aeb1ef50b7e3f02bd78c72db716-targetGraph.txt PIFCache/ There's over 55 files listed. They are all not selected but it's annoying to have them show up at all to find the files I do want to actually commit. How do I get rid of them showing? I thought about adding the whole folder to .gitignore but there is no option to do so when right clicking?
0
0
1.3k
Oct ’21
Xcode 13 : Source Control Commit showing Intermediates Folder --- Auto Build Increment
I just created a new project in Xcode 13. When I go to commit the project the Build/Intermediates/XCBuildData folder keeps showing up. I assume I don't want to commit these but I can't get them ignored. Why are they showing up all the time? It's very annoying. These files may have shown up after I enabled the Apple Generic for Versioning System under the Versioning section in the Build Settings. I'm then using agvtool next-version -all in a run script in the build phases to automatically increment the build number. If this is the cause of all these files then I need another way to handle auto build number increment. As tracking that many files just to handle a simple build number is ridiculous. It seems I can't use the old way of modifying the CFBundleVersion in the info.plist like I had done before xCode 13. Prior to xCode 13 I did this by using the following a run script in Build Phases #!/bin/bash buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE") buildNumber=$(($buildNumber + 1)) /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE" CFBundleVersion doesn't exist anymore in the info.plist file. It seems to be automatically set to $(CURRENT_PRODUCT_VERSION). I've tried changing or removing this but ended up completely breaking my project file, which I had to trash, and recreate. Thankfully I hadn't written any code yet but I've been trying to sort out this simple process for hours now. Very much welcome any thoughts or suggestions?
1
0
649
Oct ’21
registerForTaskWithIdentifier launchHandler takes 10 minutes to be called?
I'm trying to get background tasks working and I have registered both a refresh and process task. I believe I have everything in place but my tasks take 10 minutes before anything happens. I thought at first it wasn't working at all until I just left it running while writing this. I run the app from Xcode on my device and then once running I swipe up to put it in the background. I realize there is no guaranteed time for it be called. But when it allows you to pick the minimum time in seconds or even 0, what's the point? Is this because I have it running in debug mode? Also I have my device plugged into power so it shouldn't be power savings. Is 10 minutes the minimum time before a background task is executed? My app generates the following output after it launches and I swipe up to put it into the background... 2021-03-26 12:26:31.824989-0600 OpenURLTest[8518:4735105] Registering Background Tasks. 2021-03-26 12:26:31.825543-0600 OpenURLTest[8518:4735105] Registering Background Tasks : COMPLETE. 2021-03-26 12:26:35.834877-0600 OpenURLTest[8518:4735105] Scheduling REFRESH background task. 2021-03-26 12:26:35.837136-0600 OpenURLTest[8518:4735105] Scheduling REFRESH background task COMPLETE. 2021-03-26 12:26:35.837199-0600 OpenURLTest[8518:4735105] Scheduling PROCESSING background task. 2021-03-26 12:26:35.837597-0600 OpenURLTest[8518:4735105] Scheduling PROCESSING background task COMPLETE. 2021-03-26 12:26:35.842346-0600 OpenURLTest[8518:4735105] Background Refresh Status = 2 2021-03-26 12:36:50.341259-0600 OpenURLTest[8518:4735136] PROCESS : registerForTaskWithIdentifier Complete. BGTask = BGProcessingTask: com.etepstudios.OpenURLTest.process 2021-03-26 12:36:50.341391-0600 OpenURLTest[8518:4735138] REFRESH : registerForTaskWithIdentifier Complete. BGTask = BGAppRefreshTask: com.etepstudios.OpenURLTest.refresh You'll notice it takes 10 minutes + 15 seconds. For reference, here is my code and project config below that handles all this... I do have "Background fetch", "Remote Notifications", and "Background Processing" turned on under Background Modes in the capabilities for my project. I also have "Push Notifications" added as a capability. For the background task identifiers in my info.plist I have the following... keyBGTaskSchedulerPermittedIdentifiers/key array stringcom.etepstudios.OpenURLTest.refresh/string stringcom.etepstudios.OpenURLTest.process/string /array In my AppDelegate.m (Using ObjC) I have the following method... (void) registerBackgroundTasks { NSLog(@"Registering Background Tasks."); [[BGTaskScheduler sharedScheduler] registerForTaskWithIdentifier:@"com.etepstudios.OpenURLTest.refresh" usingQueue:nil launchHandler:^(__kindof BGTask * _Nonnull task) { NSLog(@"REFRESH : registerForTaskWithIdentifier Complete. BGTask = %@", task); [task setTaskCompletedWithSuccess:YES]; }]; [[BGTaskScheduler sharedScheduler] registerForTaskWithIdentifier:@"com.etepstudios.OpenURLTest.process" usingQueue:nil launchHandler:^(__kindof BGTask * _Nonnull task) { NSLog(@"PROCESS : registerForTaskWithIdentifier Complete. BGTask = %@", task); [task setTaskCompletedWithSuccess:YES]; }]; NSLog(@"Registering Background Tasks : COMPLETE."); } Then of course I have this in my didFinishLaunchingWithOptions... (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [self registerBackgroundTasks]; return YES; } I have this in my SceneDelegate.m to actually schedule the background tasks... (void)sceneDidEnterBackground:(UIScene *)scene { [self sheduleBackgroundRefresh]; [self sheduleBackgroundProcessing]; NSLog(@"Background Refresh Status = %ld", (long)[[UIApplication sharedApplication] backgroundRefreshStatus]); } Finally, I have this these two methods which are called from above when the app goes into the background... (void) sheduleBackgroundRefresh { NSLog(@"Scheduling REFRESH background task."); BGAppRefreshTaskRequest *request = [[BGAppRefreshTaskRequest alloc] initWithIdentifier:@"com.etepstudios.OpenURLTest.refresh"]; [request setEarliestBeginDate:[NSDate dateWithTimeIntervalSinceNow:3]]; NSError *error; [[BGTaskScheduler sharedScheduler] submitTaskRequest:request error:&amp;error]; if (error) { NSLog(@"Error submitting REFRESH task for background : %@", error); } NSLog(@"Scheduling REFRESH background task COMPLETE."); } (void) sheduleBackgroundProcessing { NSLog(@"Scheduling PROCESSING background task."); BGProcessingTaskRequest *request = [[BGProcessingTaskRequest alloc] initWithIdentifier:@"com.etepstudios.OpenURLTest.process"]; [request setRequiresNetworkConnectivity:YES]; [request setRequiresExternalPower:NO]; [request setEarliestBeginDate:[NSDate dateWithTimeIntervalSinceNow:45]]; NSError *error; [[BGTaskScheduler sharedScheduler] submitTaskRequest:request error:&amp;error]; if (error) { NSLog(@"Error submitting PROCESSING task for background : %@", error); } NSLog(@"Scheduling PROCESSING background task COMPLETE."); }
0
0
1.3k
Mar ’21
Initialize NSPersistentCloudKitContainer with iOS 14 and Public DB
I'm struggling to initialize my schema. I keep getting the error : Error Domain=NSCocoaErrorDomain Code=134060 "A Core Data error occurred." UserInfo={NSLocalizedFailureReason=Couldn't initialize CloudKit schema because no stores in the coordinator are configured to use CloudKit Without the initialize it does sometimes create the record's schema. But it feels like its all half working. I have Cloudkit on and Used with Cloudkit is checked under the default configuration in my xcdatamodeld file. Here is my setup code.. _persistentContainer = [[NSPersistentCloudKitContainer alloc] initWithName:@"Eco-nomy"]; // Add options and make this container PUBLIC. NSPersistentStoreDescription *description = _persistentContainer.persistentStoreDescriptions.firstObject; [description setOption:[NSNumber numberWithBool:YES] forKey:NSPersistentHistoryTrackingKey]; [description setOption:[NSNumber numberWithBool:YES] forKey:NSPersistentStoreRemoteChangeNotificationPostOptionKey]; description.cloudKitContainerOptions.databaseScope = CKDatabaseScopePublic; [description setCloudKitContainerOptions:[self getCloudKitOptions]]; NSError *error; if (![_persistentContainer initializeCloudKitSchemaWithOptions:NSPersistentCloudKitContainerSchemaInitializationOptionsPrintSchema error:&amp;error]) { NSLog (@"***** ERROR Initializing Cloudkit : %@", error); exit (0); } This is a bit of a mixed bag on how to get this setup but I've been tried multiple different paths. The example code does not show the new way of doing this schema initialization. Appreciate any thoughts here.
0
0
714
Feb ’21
Maximum Number of Characters Reached...
I'm trying to ask a question here on the forums and I got this error. The problem is, I don't know by how much I've gone over. So I don't know if I need to delete a couple of characters or half my question? Apple, I love you but I'm not wild about these forum changes. I perhaps would've prioritized the pasting of code adding in blank lines between every line first before doing a weird tag only forum change. This has been an issue for years. I have to go back and delete all those lines every time I paste a code snippet. So unfortunately I've just had to post my question to StackOverflow because I do not know how much to reduce the size of my question. Which makes me sad that I can not post it here because the user interface for the editor here does not give any user feedback on the error. Very un-Apple like. I'd post a screenshot but... how? Just my feedback. I've been in the Apple ecosystem since the Apple II+. Just want to see you be the best.
4
0
1.5k
Jul ’20