ios-app-extension

Save and Load Data on Today Extensions (iOS 8)

試著忘記壹切 提交于 2019-12-18 05:52:50
问题 Is it possible to save and load data on Today Extension using NSUserDefaults? After closing the Notification Center, the widget behaves like an app which is terminated, so any data results lost. How could I solve this issue? This is my code: NSUserDefaults *defaults; - (void)viewDidLoad { [super viewDidLoad]; defaults = [NSUserDefaults standardUserDefaults]; NSArray *loadStrings = [defaults stringArrayForKey:@"savedStrings"]; if ([loadStrings objectAtIndex:0] != nil) { [display setText:

Extension project templates not appearing in Xcode 6

末鹿安然 提交于 2019-12-18 04:29:17
问题 I'm not sure if I am the only one experiencing this program, but I have tried searching and have not been able to find anyone in my current situation. I downloaded Xcode 6 beta and was interested in Extension programming for iOS 8. However, I have been unable to locate the extensions in my project templates when creating a new project in Xcode, I saw a YouTube video (unrelated to extension programming) but I did notice that the option was not there for the said video. Now, I have had a look

Accessing Core Data from both container app and extension

泪湿孤枕 提交于 2019-12-18 01:15:42
问题 I'm developing app and share extension and trying to use core data. But when I'm inserting items in the extension those items only visible in extension but not from container app (e.g I perform NSFetchRequest from app and getting zero items but in app I got >0). I'm using the following code for getting the persistent container: lazy var persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: "appname") container.loadPersistentStores(completionHandler: {

How to make popup like keyboard characters in iOS8 custom keyboard?

放肆的年华 提交于 2019-12-17 22:40:49
问题 I want to create popup in iOS8 custom keyboard as shown below image. Some code are working but can't access outer window of keyboard and occures issue as shown in below image-2 回答1: This what i have done in my custom Keyboard its working //adding pop up when character is tapped - (void)addPopupToButton:(UIButton *)button { CGRect frame,frame1; if(self.view.frame.size.width == 320) { //Keyboard is in Portrait frame = CGRectMake(0, -25, 28, 43); frame1=CGRectMake(0, 0, 28, 43); } else{ /

Fit width in iOS 8 Today Extensions

a 夏天 提交于 2019-12-17 21:57:49
问题 When I make any iOS 8 Today Extension, there is an empty space on the left of approximately 48px, even if in Interface Builder I place a label on the left side at x=0. I have seen that some apps, however, use a full-width widget. How can I achieve something similar? Thanks! UPDATE: SOLVED I put here the sample code because I guess it will be useful to someone. As suggested by @matteo-lallone, the correct way to do this is: -(UIEdgeInsets)widgetMarginInsetsForProposedMarginInsets:(UIEdgeInsets

What is the best way to detect orientation in an app extension?

假装没事ソ 提交于 2019-12-17 18:53:14
问题 What is the best way to detect a device's orientation in an application extension? I have had mixed results with solutions I've found on here: How to detect Orientation Change in Custom Keyboard Extension in iOS 8? Get device current orientation (App Extension) I have looked at size classes and UITraitCollection and found that the device inaccurately reports that it is in portrait when it is in fact in landscape (not sure if this is OS bug, or I am not querying the right APIs the right way).

launch containing app from iOS8 Custom Keyboard

守給你的承諾、 提交于 2019-12-17 08:53:24
问题 I want to launch my containing app. I tried using URL schemes. The URL scheme launched the app from other places - so the problem is not there. Looks like this object is nil: self.extensionContext thus i can't run this method: [self.extensionContext openURL:url completionHandler:nil]; Can I launch my app? Do URL Schemes work in a custom keyboard? thanks! 回答1: Try this code UIResponder* responder = self; while ((responder = [responder nextResponder]) != nil) { NSLog(@"responder = %@",

Today App Extension Widget Tap To Open Containing App

自作多情 提交于 2019-12-17 07:14:52
问题 I've implemented a Today widget for my application +Quotes which displays the day's quote within the notification center with the help of these Apple Docs. What I'd like to accomplish is opening the Containing App, in this case +Quotes, when the user taps the +Quotes widget within their Today notification view, not entirely sure what to call this, as Calendar would if you tapped it in the Today view. I've tried overlaying a button over the label which would call -(void)openURL:(NSURL *)URL

Can a custom keyboard extension communicate with the companion app at runtime?

痞子三分冷 提交于 2019-12-13 09:04:39
问题 Can a custom keyboard communicate with the companion app at runtime? Can a custom keyboard dynamically display content based on states set in the companion app? If so, what API’s/documentation is available for this communication between the extension and app? 回答1: Here is a nice paragraph from the documentation that could get you started in sharing data with your companion app: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/ExtensibilityPG

How prevent view under navbar in iMessage app extension

若如初见. 提交于 2019-12-13 06:59:45
问题 I have the same issue in this post, i follow all recommended in that answers but notting works, in my case the difference is that i have a table view controller. I have tried in many ways to prevent this from happening. example: -(void)viewDidLayoutSubviews { //the next 2 lines was tested with self.tableView and self.view [self.view.topAnchor constraintEqualToAnchor:self.topLayoutGuide.bottomAnchor constant:8.0].active = YES; [self.view constraintEqualToAnchor:[self.topLayoutGuide