Check if Local Notifications are enabled in IOS 8

You can check it by using UIApplication ‘s currentUserNotificationSettings if ([[UIApplication sharedApplication] respondsToSelector:@selector(currentUserNotificationSettings)]){ // Check it’s iOS 8 and above UIUserNotificationSettings *grantedSettings = [[UIApplication sharedApplication] currentUserNotificationSettings]; if (grantedSettings.types == UIUserNotificationTypeNone) { NSLog(@”No permiossion granted”); } else if (grantedSettings.types & UIUserNotificationTypeSound & UIUserNotificationTypeAlert ){ NSLog(@”Sound and alert permissions “); } else if (grantedSettings.types & UIUserNotificationTypeAlert){ NSLog(@”Alert … Read more

How to prevent status bar from overlapping content with hidesBarsOnSwipe set on UINavigationController?

Actually it is pretty easy to do. You just need to connect navigation isNavigationBarHidden property with status bar. Objective-C – (BOOL)prefersStatusBarHidden { return self.navigationController.isNavigationBarHidden; } Swift <= 2.3 override func prefersStatusBarHidden() -> Bool { return navigationController?.navigationBarHidden ?? false } Swift 3.0 override var prefersStatusBarHidden: Bool { return navigationController?.isNavigationBarHidden ?? false } And be sure you … Read more

How to check the “Allow Full Access” is enabled in iOS 8?

UPDATE 08/23/2017 for iOS 10 compatibility: func isOpenAccessGranted() -> Bool{ UIPasteboard.general.string = “CHECK” return UIPasteboard.general.hasStrings } iOS 8: -(BOOL)isOpenAccessGranted{ return [UIPasteboard generalPasteboard]; } Please note that the simulator will always tell you that you have Full Access so for this to work properly you need to run it from a device.

@property/@synthesize equivalent in swift

Swift provides no differentiation between properties and instance variables (i.e, the underlying store for a property). To define a property, you simply declare a variable in the context of a class. A swift class is simply a ClassName.swift file. You declare a class and properties as class SomeClass { var topSpeed: Double var aStrProperty: String … Read more

On iOS8, displaying my app in landscape mode will hide the status bar but on iOS 7 the status bar is displayed on both orientations

Try this Add below code in didRotateFromInterfaceOrientation [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; EDIT NO NEED TO WRITE CODE IN ALL VIEW CONTROLLER Set View controller-based status bar appearance to NO in plist and add below code in root view controller’s viewDidLoad [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone]; Demo project https://www.dropbox.com/s/uumneidk4wom5md/demoStatusBar.zip?dl=0

Facebook iOS8 SDK build module error for FBSDKCoreKit

FBSDKCoreKit can’t be built because of “include of non-modular header inside framework module” error in FBSDKAppLinkResolver.h header file: in #import <Bolts/BFAppLinkResolving.h> line. The solution from Swift compiler error: “non-modular header inside framework module” (switching CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES) did’t help me. My solution: Create in Bolts.framework file module map: Modules/module.modulemap (like in FBSDKCoreKit.framework) Put such code … Read more

How to create a single shared framework between iOS and OS X

If you wish to create a single dynamic framework binary, here are the steps you can follow (as outlined in http://colemancda.github.io/2015/02/11/universal-ios-osx-framework): 1. Change the project’s valid architectures and supported platforms. This should change your framework’s and test unit’s valid architectures and supported platforms as well. If not, then manually change them to inherit from the … Read more

How to disable iOS 8 emoji keyboard?

Try this: – (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { if ([textField isFirstResponder]) { if ([[[textField textInputMode] primaryLanguage] isEqualToString:@”emoji”] || ![[textField textInputMode] primaryLanguage]) { return NO; } } return YES; } for more info see here. EDIT : You can hide emoji from Keyboard using this code: txtField.keyboardType=UIKeyboardTypeASCIICapable; EDIT : Hide emoji selection from keyboard using … Read more