How to detect whether custom keyboard is activated from the keyboard’s container app?

Here is a method I have used in one of my projects. I think it is what you asked for, hope it helps you. – (BOOL)isCustomKeyboardEnabled { NSString *bundleID = @”com.company.app.customkeyboard”; // Replace this string with your custom keyboard’s bundle ID NSArray *keyboards = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] objectForKey:@”AppleKeyboards”]; // Array of all active keyboards for … Read more

UITableView with two custom cells (multiple identifiers)

* I’ve renamed some of your NIB/Class names for a better understanding. * First, you should register each cells’ NIB: – (void)viewDidLoad{ [super viewDidLoad]; static NSString *CellIdentifier1 = @”ContentCell”; static NSString *CellIdentifier2 = @”SpaceCell”; UINib *nib = [UINib nibWithNibName:@”CellViewNIBName” bundle:nil]; [self.tableView registerNib:nib forCellReuseIdentifier:CellIdentifier1]; nib = [UINib nibWithNibName:@”CellSpaceNIBName” bundle:nil]; [self.tableView registerNib:nib forCellReuseIdentifier:CellIdentifier2]; self.contentView.hidden = YES; [self … Read more

+entityForName: nil is not a legal NSManagedObjectContext parameter searching for entity name ‘Account”

– (NSManagedObjectContext *)managedObjectContext { if (managedObjectContext != nil) return managedObjectContext; NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator]; if (coordinator != nil) { managedObjectContext = [[NSManagedObjectContext alloc] init]; [managedObjectContext setPersistentStoreCoordinator:coordinator]; } return managedObjectContext; } You haven’t provided a lazy loading implementation of persistentStoreCoordinator so coordinator will always be nil so you will always be returning nil from this … Read more

iOS 6 – viewDidUnload migrate to didReceiveMemoryWarning?

The short answer is that, in many cases, you don’t need to change anything. And, you most certainly do not want to simply migrate all of the contents of viewDidUnload to didReceiveMemoryWarning. Generally, most of us do the setting of IBOutlet references to nil in viewDidUnload (largely because Interface Builder would put that there for … Read more

How to display an image using URL?

The error is most likely that imageURL is nil. Are you assigning it a value elsewhere in the code, or is it actually @IBOutlet in the real code? If you do not assign a value to it, it will be nil – but its type of UIImageView! means it is an “implicitly unwrapped optional” which … Read more

Getting username and profile picture from Facebook iOS 7

This is the simplest way I’ve found to get the user’s profile picture. [[FBRequest requestForMe] startWithCompletionHandler:^(FBRequestConnection *connection, NSDictionary<FBGraphUser> *FBuser, NSError *error) { if (error) { // Handle error } else { NSString *userName = [FBuser name]; NSString *userImageURL = [NSString stringWithFormat:@”https://graph.facebook.com/%@/picture?type=large”, [FBuser objectID]]; } }]; Other query parameters that can be used are: type: small, … Read more

table header view height is wrong when using auto layout, IB, and font sizes

Note: A Swift 3+ version can be found here: https://gist.github.com/marcoarment/1105553afba6b4900c10#gistcomment-1933639 The idea is to calculate header’s height with help of systemLayoutSizeFittingSize:targetSize. Returns the size of the view that satisfies the constraints it holds. Determines the best size of the view considering all constraints it holds and those of its subviews. After changing header’s height it … Read more

tech