Post

Replies

Boosts

Views

Activity

Trying to Share a Record, "Only shared zones can be accessed..."
I'm struggling to share a record. I'm getting and error that my zone is not shared. No idea how to share the zone either than doing the process below. Error is here... <CKError 0x28107db30: "Partial Failure" (2/1011); "Failed to modify some records"; uuid = 025CA822-96A0-46FB-B2EE-7CB06D1ECCF8; container ID = "iCloud.[MY DOMAIN]"; partial errors: { Share-182263AB-B5AC-466D-A5D0-34F63D37ADDA:(GameZone:defaultOwner) = &lt;CKError 0x281077bd0: "Invalid Arguments" (12/2006); server message = "Only shared zones can be accessed in the shared DB"; uuid = 025CA822-96A0-46FB-B2EE-7CB06D1ECCF8&gt; I created a custom zone using the following... CKContainer *container = [CKContainer defaultContainer]; CKDatabase *db = container.privateCloudDatabase; CKRecordZone *tempZone = [[CKRecordZone alloc] initWithZoneName:@"GameZone"]; [db saveRecordZone:tempZone completionHandler:^(CKRecordZone * _Nullable zone, NSError * _Nullable error) { if (error != nil) { NSLog(@"%@", error); } else { NSLog(@"Successfully created GameZone --- %@", zone); } }]; I then saved a Record using this zone. I've confirmed that the record exists, in that zone, in my private Database on the dashboard. I then initiate the share (using the UICloudSharingController) as follows... Game *theGame = [self.common.coreManager getGameByObjectID:self.gameObjectID]; CKRecord *record = [[CKRecord alloc] initWithRecordType:@"Game" recordID:theGame.ckID]; UICloudSharingController *sharingController = [[UICloudSharingController alloc] initWithPreparationHandler:^(UICloudSharingController * _Nonnull controller, void (^ _Nonnull preparationCompletionHandler)(CKShare * _Nullable, CKContainer * _Nullable, NSError * _Nullable)) { [CloudKitManager shareRootRecord:record name:theGame.name completion:preparationCompletionHandler]; }]; [sharingController setModalPresentationStyle:UIModalPresentationFullScreen]; [self presentViewController:sharingController animated:YES completion:nil]; Finally my CloudKitManager shareRootRecord looks like this... (void)shareRootRecord:(CKRecord *)rootRecord name:(NSString *)name completion:(void (^)(CKShare * _Nullable share, CKContainer * _Nullable container, NSError * _Nullable error))completion {     CKShare *shareRecord = [[CKShare alloc] initWithRootRecord:rootRecord];     shareRecord[CKShareTitleKey] = name; shareRecord[CKShareTypeKey] = @"com.lmw.YouDJ"; [shareRecord setPublicPermission:CKShareParticipantPermissionReadOnly];     NSArray *recordsToSave = @[rootRecord, shareRecord];     CKContainer *container = [CKContainer defaultContainer];     CKDatabase *privateDatabase = [container sharedCloudDatabase];     CKModifyRecordsOperation *operation = [[CKModifyRecordsOperation alloc] initWithRecordsToSave:recordsToSave recordIDsToDelete:@[]];     [operation setModifyRecordsCompletionBlock:^(NSArray&lt;CKRecord *&gt; * _Nullable savedRecords, NSArray&lt;CKRecordID *&gt; * _Nullable deletedRecordIDs, NSError * _Nullable error) { if (error) {             NSLog(@"%@", error);         }         completion(shareRecord, container, error);     }];     [privateDatabase addOperation:operation]; } Line 19 is the output of this error. I'm confused what to do here. I though the act of sharing out this record in this custom zone should make that zone shared? I'm not sure what else I'm supposed to do on the custom zone? I can't find anything in the Documentation or even online about how to share the custom zone either than just sharing the record. Very much appreciate any suggestions here.
0
1
583
Jul ’20
Error while trying to save two records with CKReference to each other
I'm getting the following error... Invalid list of records: Cycle detected in record graph This happens when I try to save two records with references to each other. The two record types I have are called Game and Chat. A Chat is part of a game (eventually I will have Message(s) as part of Chat which would be a one to many relationship but will tackled that another time.) I create two CKReference objects. One for Game and one for my Chat object. I then put this into a CKModifyRecordsOperation and then get the error above. I'm uncertain what I'm missing? Here is how I'm creating the records... CKRecordZoneID *zoneID = [[CKRecordZone alloc] initWithZoneName:GameZoneName].zoneID; self.record = [[CKRecord alloc] initWithRecordType:@"Game" zoneID:zoneID]; [self setCoreValues:self fromRecord:self.record]; self.record[@"name"] = self.name = theGame.name; self.chat = [[CKRecord alloc] initWithRecordType:@"Chat" zoneID:zoneID]; self.chat[@"name"] = theGame.chat.name; CKReference *gameRef = [[CKReference alloc] initWithRecordID:self.record.recordID action:CKReferenceActionNone]; self.chat[@"game"] = gameRef; [self.chat setParent:gameRef]; CKReference *chatRef = [[CKReference alloc] initWithRecordID:self.chat.recordID action:CKReferenceActionDeleteSelf]; self.record[@"chat"] = chatRef; I then use the following to save the record to CloudKit... CKContainer *container = [CKContainer defaultContainer]; CKDatabase *db = container.privateCloudDatabase; NSLog (@"Saving Game with name = %@", self.record[@"name"]); NSMutableArray *records = [[NSMutableArray alloc] init]; [records addObject:self.record]; [records addObject:self.chat]; NSLog(@"self.record.recordID = %@", self.record.recordID); NSLog(@"self.record[chat] = %@", self.record[@"chat"]); NSLog(@"self.chat.recordID = %@", self.chat.recordID); NSLog(@"self.chat[game] = %@", self.chat[@"game"]); CKModifyRecordsOperation *operation = [[CKModifyRecordsOperation alloc] initWithRecordsToSave:records recordIDsToDelete:nil]; operation.atomic = NO; operation.database = db; [operation setModifyRecordsCompletionBlock:^(NSArray&lt;CKRecord *&gt; * _Nullable savedRecords, NSArray&lt;CKRecordID *&gt; * _Nullable deletedRecordIDs, NSError * _Nullable operationError) { if (operationError) { failure (operationError); } else { success (savedRecords); } }]; if (self.saveQueue == nil) self.saveQueue = [[NSOperationQueue alloc] init]; [self.saveQueue addOperation:operation]; My operation hits line 24 and outputs the error above. The only thing I can think of is that I'm creating the references incorrectly? But everything I've seen both in the documentation and online resources shows this as being correct.
2
0
727
Jul ’20
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.2k
Jul ’20
CKFetchRecordZoneChangesOperation not calling recordWithIDWasDeletedBlock on Shared Record Deletion
I have a record that I share from device A to device B. Device B accepts the share and show the info on Device B's UI. Device B subscribes to Database changes on that shared record using a CKDatabaseSubscription. I then delete that record on device A which then triggers a notification to Device B about a database change. I then handle that notification on Device B by fetching the DB changes using a CKFetchDatabaseChangesOperation. I then subsequently get the Zone changes using a CKFetchRecordZoneChangesOperation. I get calls to recordZoneFetchCompletionBlock and fetchRecordZoneChangesCompletionBlock but that is it. Neither recordChangedBlock nor recordWithIDWasDeletedBlock is called. It is important to note I'm using this exact same code to monitor shared records of another type and it works. It's actually a record that is a child of a child in this record. So I'm not sure why this top level/parent record would not show as being deleted when queried. The record does delete from CloudKit when Device A deletes it (both on its private DB and on the shared DB of DeviceB). So it's not a relationship or restriction of any kind on CloudKit I don't believe. Welcome any thoughts how to chase this one down. Been at this for a week. This is the code I'm using to subscribe... Subscription Code Snippet - https://developer.apple.com/forums/content/attachment/9fe6a1fa-f5da-4c48-9a19-43ed76ff3f1d Here is the code I'm using to handle the notification and do the two operations above. Notification Handling Code Snippet - https://developer.apple.com/forums/content/attachment/290e29a7-8127-40ad-8040-58d9ade5d442
0
0
405
Jul ’20
Call to [[SKCloudServiceController alloc] init] Throwing Confusing SSAccountStore Errors
I'm music MusicKit and everything is actually working fine. I can get my tokens, do my searches, play the music. All good. The reason for my question is that when I make the call to initialize the SKCloudServiceController I get a bunch of errors in the console I'd like to cleanup. In this snippet below I'm getting the authorization from the user and then retrieving the store country code for the user. [SKCloudServiceController requestAuthorization:^(SKCloudServiceAuthorizationStatus status) { if (status != SKCloudServiceAuthorizationStatusAuthorized) { NSLog (@"Access to StoreKit not approved by user : code %ld", (long)status); } else { self.cloudController = [[SKCloudServiceController alloc] init]; [self.cloudController requestStorefrontCountryCodeWithCompletionHandler:^(NSString * _Nullable storefrontCountryCode, NSError * _Nullable error) { if (error) { NSLog(@"ERROR : Getting Music Store Country Code for this User : %@", error); } else { self.countryCode = storefrontCountryCode; } }]; } }]; This all works fine. But at line 9 these errors are thrown that really don't seem to affect anything. But I'd like to clean them up if possible. [10169:2681453] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)"" [10169:2681453] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)" [10169:2681449] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)"" [10169:2681449] SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)" [10169:2681449] SSAccountStore: Unable to get the local account. error = Error Domain=SSErrorDomain Code=100 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store} Any suggestions? I feel like I've missed something that I should've done and may bite me in the future if I don't get this cleared up.
2
0
612
Aug ’20
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
666
Feb ’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.2k
Mar ’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
560
Oct ’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.2k
Oct ’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
817
Nov ’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
587
Dec ’21
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
422
Dec ’21
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
476
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?
1
0
1.8k
Jan ’22
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?
1
0
401
Jan ’22