Posts

Post not yet marked as solved
1 Replies
488 Views
I'm trying to right align the text that is shown up in the table view section header from its datasource call viewForHeaderInSection using the following code but the text is still left aligned. I tried other alignment options but none worked. Can someone help me out please. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UITableViewHeaderFooterView *headerView = [[UITableViewHeaderFooterView alloc] initWithFrame:CGRectMake(legendTableView.frame.origin.x, legendTableView.frame.origin.y, legendTableView.frame.size.width, 10)]; headerView.textLabel.textAlignment = NSTextAlignmentRight; double total= 0; for (Amount *amountObj in currentArray) { total=total+[amountObj.amount doubleValue]; } NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init]; currencyFormatter.numberStyle = NSNumberFormatterCurrencyStyle; NSString *amountString = [currencyFormatter stringFromNumber:[NSNumber numberWithDouble:total]]; NSString *totalString = [NSString stringWithFormat:@"Total: %@",amountString]; headerView.textLabel.text = totalString; return headerView; } Thanks. Neerav
Posted Last updated
.
Post marked as solved
1 Replies
365 Views
Inspite of datecomponents being what I set to (i.e, 12 PM) and the date object being correct -5:30 hours from my time zone IST), when I try and set the date on the picker using setDate:Animated: method, the time remains to current time (ie, the time the view controller containing the picker appears). Can someone explain what could be wrong? - (void)viewDidLoad {     [super viewDidLoad];     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];     NSData *hAndMData = [[NSUbiquitousKeyValueStore defaultStore] objectForKey:@"AddReminder"];     NSError *error;     hoursAndMinutes = [NSKeyedUnarchiver unarchivedObjectOfClass:[NSDateComponents class] fromData:hAndMData error:&error];     if (error!=nil) {         NSLog(@"error in unarchiving date componenet in settingsVC: %@",error);     }     else     {         dateForNotification = [[NSCalendar currentCalendar] dateFromComponents:hoursAndMinutes];     } } -(void)viewDidAppear:(BOOL)animated {     [super viewDidAppear:YES];     [reminderCell.addReminderTVCTimePicker setDate:dateForNotification animated:YES]; } Thanks Neerav
Posted Last updated
.
Post marked as solved
1 Replies
493 Views
Capabilities- push notification. Time sensitive notification. Added below is my method that requests for and sets up notification… (void)authorizeAndCreateNotificationFromDateComponents:(NSDateComponents *)dateComponents { UNUserNotificationCenter *notificationCenter = [UNUserNotificationCenter currentNotificationCenter]; [notificationCenter requestAuthorizationWithOptions:UNAuthorizationOptionAlert|UNAuthorizationOptionBadge|UNAuthorizationOptionSound|UNAuthorizationOptionProvisional completionHandler:^(BOOL granted, NSError *error){ if (granted) { UNMutableNotificationContent *notificationContent = [[UNMutableNotificationContent alloc] init]; notificationContent.title = @"Add"; notificationContent.body = @"Is it time. Tap to add."; UNCalendarNotificationTrigger *notificationtrigger = [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:dateComponents repeats:YES]; UNNotificationRequest *notificationRequest = [UNNotificationRequest requestWithIdentifier:@"AddReminder" content:notificationContent trigger:notificationtrigger]; [notificationCenter addNotificationRequest:notificationRequest withCompletionHandler:^(NSError *error){ if (error!=nil) { NSLog(@"Notification error: %@",error.userInfo); } }]; } }]; } i call this method from application did finish launching with the following code… NSDateComponents *hoursAndMinutes = [[NSCalendar currentCalendar] components:NSCalendarUnitHour|NSCalendarUnitMinute fromDate:[NSDate dateWithTimeIntervalSinceNow:20]]; [self authorizeAndCreateNotificationFromDateComponents:hoursAndMinutes]; I am testing this on a device and i dont see any notifications. Although i did see the app in settings.app and immediate, time sensitive and silent (only in notification center without badge or sound) notification have been enabled. what could be wrong?
Posted Last updated
.
Post marked as solved
2 Replies
443 Views
i have a UIDatePickerView in compact style and for some reason highlighting of selected date has stopped working. I notice that the date is selected (from action method valueChanged) but the light blue circle highlighting the date is not showing up. what could be the reason? i am using storyboard and objective c
Posted Last updated
.
Post marked as solved
1 Replies
443 Views
UIMenu documentation uses UIKeyCommand to make a UIMenu. I made one for a UIBarButtonItem. UIKeyCommand documentation says Key command sequences are generated only for devices with an attached hardware keyboard. But it's working fine on my iPhone SE. I don't understand this. Can some explain please? Thanks.
Posted Last updated
.
Post not yet marked as solved
0 Replies
476 Views
I have set up a pulldown button in the navigation bar which automatically got embedded in a UiBarButtonItem. Menus have been set up from interface builder itself. since UIBarbuttonItem doesn't have a showMenuAsPrimaryAction property. Now when I run the code on device or simulator, I don't see the menu pop up. Neither on tap nor or long press. I don't know what I'm doing wrong. Please see the screenshot of storyboard. The button has no title just an Image which is not seen when double clicked on it (to reveal the menu) in interface builder. So don't be confused with the empty white space in place of the button.
Posted Last updated
.
Post marked as solved
1 Replies
836 Views
Hi iOS 16 onwards iPhones will also calculate energy burned. Is ActiveEnergyBurned the unit for that? My app specifically calculates energy burned through steps. As per the documentation I think ActiveEnergyBurned is a measure of energy even through other exercises. Can someone through some light? Thanks.
Posted Last updated
.
Post not yet marked as solved
0 Replies
525 Views
The release version of my app will Not collect user data. I wanted to know if I can ask for users permission to collect trained ml models based on beta users data on test flight after presenting them the necessary documentations like privacy policy. I also don’t want the user to be able to use the beta app if they don’t agree to it. are these two things possible? Thanks
Posted Last updated
.
Post marked as solved
3 Replies
16k Views
macOS 10.15.3xcode 11.3.1 device iphone 6 iOS 12.4.5development target iOS 12problem - app shows launch screen and then shows a black screen without any UI.the app works fine on simulator ios 13 iphone 8. the app worked fine on the device until i accidentally deleted scene delegate, which I have added since.there are no error messages and the app hasn't crashed.what troubleshooting could i do.
Posted Last updated
.
Post not yet marked as solved
0 Replies
577 Views
I have a new model which syncs to cloudkit. I'have to migrate my old core data store which is local to the new model which will store in cloudkit. I'm not sure how to perform this migration. The container is initialised correctly and the Mapping Model is mapping my entities and attributes correctly. There are no errors. Yet, I do not see my old records upon fetching. I found this lines of code here... NSDictionary *optionsDictionary = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, [NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, <#Ubiquitous content name#>, NSPersistentStoreUbiquitousContentNameKey, nil]; However, I'm not sure where to add it. Since, I had created a new project folder with core data + CloudKit (and imported the old model), this is the method i got in AppDelegate which initialises the store... - (NSPersistentCloudKitContainer *)persistentContainer {     // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it.     @synchronized (self) {         if (_persistentContainer == nil) {             _persistentContainer = [[NSPersistentCloudKitContainer alloc] initWithName:@"Expenses"];             [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) {                 if (error != nil) {                     NSLog(@"Unresolved error %@, %@", error, error.userInfo);                     abort();                 }             else #ifdef DEBUG                     NSLog(@"Store successfully initialized"); #endif             }];         }     }     return _persistentContainer; } Please help, Thanks.
Posted Last updated
.
Post not yet marked as solved
0 Replies
398 Views
I'm trying to see if the mapping of my two models is inferred using lightweight migration. This is because I'm not able to retrieve entities created using old model. I get empty array upon fetching. The code I've written is as follows... NSError *error; NSManagedObjectModel *expensesModel1 = [[NSManagedObjectModel alloc] initWithContentsOfURL:expensesModel1URL];  NSManagedObjectModel *expensesModel2 = [[NSManagedObjectModel alloc] initWithContentsOfURL:expensesModel2URL]; NSMappingModel *mappingModel = [NSMappingModel inferredMappingModelForSourceModel:expensesModel1 destinationModel:expensesModel2 error:&error]; Now, both URLs are set, i.e., they are not Nil. But, both the NSManagedObjectModel objects (expensesModel1, expensesModel2 )remain nil. The error I get is... 2021-12-28 14:39:21.226111+0530 Expenses Pro[2248:634959] [error] error:  Failed to load model as no file exists at path '/Users/neeravkothari/Current Project/Expenses Pro v2/Expenses Pro/Expenses Pro/Model/Core Data/Expenses.xcdatamodeld/Expenses.xcdatamodel' CoreData: error:  Failed to load model as no file exists at path '/Users/neeravkothari/Current Project/Expenses Pro v2/Expenses Pro/Expenses Pro/Model/Core Data/Expenses.xcdatamodeld/Expenses.xcdatamodel' 2021-12-28 14:39:21.226201+0530 Expenses Pro[2248:634959] [error] error: Unable model at path (file is zero bytes) '/Users/neeravkothari/Current Project/Expenses Pro v2/Expenses Pro/Expenses Pro/Model/Core Data/Expenses.xcdatamodeld/Expenses.xcdatamodel' CoreData: error: Unable model at path (file is zero bytes) '/Users/neeravkothari/Current Project/Expenses Pro v2/Expenses Pro/Expenses Pro/Model/Core Data/Expenses.xcdatamodeld/Expenses.xcdatamodel' I get a similar 4 line error for the destination model Expenses 2.xcdatamodel What is the issue here? Neerav
Posted Last updated
.
Post not yet marked as solved
1 Replies
402 Views
I have used lightweight migration and there are no errors in loading the new store but when i fetch an entity i get an empty array. What could be the reason? there is something worth considering. The old store had an entity A which had a relationship with entity B and C, both or which are no longer included in the new model. Just incase such a thing could be a issue. Thanks. Neerav
Posted Last updated
.
Post not yet marked as solved
0 Replies
322 Views
I am looking for an API that lets user schedule an auto repeat of a user generated event. Basically repeat adding of a new entry of user data, based on the current one where in Repeat has been selected. The scheduler should have predefined time intervals like daily, monthly, etc., apart from a calendar view to select dates or time ranges. Even if I can know what such kind of an API is called, it would be of great help. Thank you. Neerav
Posted Last updated
.