nil object in iOS8 delegate methods – custom keyboards

Good question. But it seems that UITextInputDelegate is not a protocol that you implement. From Apple Docs titled Lower Level Text-Handling Technologies: When changes occur in the text view due to external reasons—that is, they aren’t caused by calls from the text input system—the UITextInput object should send textWillChange:, textDidChange:, selectionWillChange:, and selectionDidChange: messages to … Read more

How to detect Orientation Change in Custom Keyboard Extension in iOS 8?

In order to update your custom keyboard when the orientation changes, override viewDidLayoutSubviews in the UIInputViewController. As far as I can tell, when a rotation occurs this method is always called. Additionally, as the traditional [UIApplication sharedApplication] statusBarOrientation] doesn’t work, to determine the current orientation use the following snippet: if([UIScreen mainScreen].bounds.size.width < [UIScreen mainScreen].bounds.size.height){ //Keyboard … Read more

How to detect if code is running in Main App or App Extension Target?

You can use a preprocessor macro: In the project settings use the dropdown in the topbar to select your extension target: Then: Click Build Settings Find (or search) Preprocessor Macros under Apple LLVM 6.0 – Preprocessing Add TARGET_IS_EXTENSION or any other name of your choice in both the debug and release sections. Then in your … Read more

Today Extension height for iPad much larger than specified

Here’s how to achieved this: You should consider your constraint. Your widgets default margin insets are not properly configured on the way you desired it, so setting this on your own is the only workaround here by calling ‘widgetMarginInsetsForProposedMarginInsets:’ // Update widgets insets func widgetMarginInsetsForProposedMarginInsets(defaultMarginInsets: UIEdgeInsets) -> UIEdgeInsets { println(NSStringFromUIEdgeInsets(defaultMarginInsets)) return UIEdgeInsetsMake(20, 20, 10, 20) … Read more

openURL not work in Action Extension

This is what I used to do: UIWebView * webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]; NSString *urlString = @”https://itunes.apple.com/us/app/watuu/id304697459″; NSString * content = [NSString stringWithFormat : @”<head><meta http-equiv=’refresh’ content=”0; URL=%@”></head>”, urlString]; [webView loadHTMLString:content baseURL:nil]; [self.view addSubview:webView]; [webView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:2.0]; Please note that in this case I am instantiating this call from the … Read more

Provisioning profile for Today Widget extension

I was struggling with the same problem, and resolved it this way: You need one App ID configured to the provisioning portal (I assume you have your com.apple.yourappname there) You need to then configure the second App ID for the Today Widget (which should be com.apple.yourappname.something, where something is the name for your widget, like … Read more