Tag: objective c

makeKeyAndOrderFront barfs on second use… (ARC?)

Question… I’ve previously used this code from my MainMenu.xib to manage windows: — if([olt_MainMenu_WINDOW isVisible]){ [olt_MainMenu_WINDOW setReleasedWhenClosed:NO]; [olt_MainMenu_WINDOW close]; } …and then if(olt_DoSomething_WINDOW == nil) if(![[NSBundle mainBundle] loadNibNamed:@”DoSomething” owner:self topLevelObjects:nil]) NSBeep(); if(olt_DoSomething_WINDOW != nil) [olt_DoSomething_WINDOW makeKeyAndOrderFront:nil]; — …then go back to my window in my MainMenu.xib: — if([olt_DoSomething_WINDOW isVisible]){ [olt_DoSomething_WINDOW setReleasedWhenClosed:NO]; [olt_DoSomething_WINDOW close]; } …and […]

perform realm migration for multiple .realm files

i have multiple realm files, (one per user logged into my app) and i need to run a migration for each realm file in the file system RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration]; config.schemaVersion = 1; config.migrationBlock = ^(RLMMigration *migration, uint64_t oldSchemaVersion) { if (oldSchemaVersion < 1) { //do the same changes for all file.realm in […]

make custom view stick to top of the keyboard while rotating device

My app is iPad only and the root view is embedded in a navigation controller which has two sub views: 1) a UITextView (not UITextField) which covers the whole area except for the navigation bar. 2) another UIView which serves as a tool bar. It covers the UITextView and initially stays at the bottom of […]

Parse iOS – Send push notification at specific time

A part of my app currently lets a user schedule appointments using a UIDatePicker. They press a button and my backend does some work with the date to store the appointment data, then I send a push using the following code: NSString *objectID = [NSString stringWithFormat:@”user_%lu”, (unsigned long)self.salespersonObject.userID]; PFPush *push = [PFPush new]; [push setChannel:[NSString […]

Loading data after one second in uitableview. Any alternate way to eliminate this delay

NSURL *url=[NSURL URLWithString:string]; dispatch_queue_t backgroundQueue = dispatch_queue_create(“com.example.workQueue”, DISPATCH_QUEUE_SERIAL); dispatch_async(backgroundQueue, ^{ NSData *data=[NSData dataWithContentsOfURL:url]; NSDictionary *json=[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil]; NSLog(@”%@”,json); marray=[NSMutableArray array]; for (NSDictionary *dict in json) { } dispatch_async(dispatch_get_main_queue(), ^{ [self.tableView reloadData]; }); }); Is this the right way to handle data and reload the table in Objective C? If yes, then I still see […]

Warning about sendsynchronousRequest:returningResponse:error: is deprecated:first seprecated in ios 9-

And it says use [NSURLSession sharedsession] dataTaskwithRequest:request completionHandler:] So here my code: NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; I changed above code to like this: NSData *returnData = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:nil]; I got 2 warning: Null passed to a callee that requirs a non-null argument Incomplete pointer type initializing ‘NSData’ with a expression […]

iOS Admob Firebase SDKs with/without cocoapods

I was trying to add cocoapods for admob firebase in my iOS app. But pod intsall command took too much time. Now i want to add firebase admob directly without cocoapods. I have downloaded whole SDK from https://dl.google.com/firebase/sdk/ios/3_5_2/Firebase.zip . It shows several folder with like AdMob Analytics, AppIndexing, Auth,Crash, Database,DynamicLinks, Invites, Messaging, RemoteConfig, Storage. For […]

UIDatePicker return value in 24-hour-format

I’m new to iPhone development and now working on my first app. I have an UIDatePicker on a view and, if the user clicks on save, the current time of the date picker should be saved in the database (in format hh:mm). Now, the problem is that my UIDatePicker has a 24-hour-format to choose the […]

How to call my method in cocoa, self doesn't work

Working on a program that will record some things from the webcam when a user presses physical buttons connected to the mac via phidgets. Have call methods on other places in my app simply doing [self method: input], but on one place it doesn’t work. What could be wrong? This is the method i want […]

Make Button touchUpInside FBLoginView

I have a FBLoginView with property loginButton, and I want to make a button that is not in the same view fire this FBLoginView built in button feature. Does anyone have any suggestions? thanks