Today Extension is a new feature introduced in iOS8, if needed to obtain information in real time, you can create an extension implemented in Today's Today view of Notification Center, also known as Extended Today Widget. Based XCode8 introduced.
If the need to expand the program and the main program to exchange information directly, it is necessary to apply the group ID (group id), i.e. in the main application App ID Bundle ID Bundle ID and expansion program to set, as in FIG.
Then create Today in XCode in:
Once created the directory structure is as follows:
Then Target - Capabilities App Groups will open, and the corresponding ID added
Then modify Xib or can be constructed with the code Today, the final effect is as follows:
Traditional values to the main program:
[self.extensionContext openURL:[NSURL URLWithString:@"Test://Test=open"] completionHandler:^(BOOL success) {
}];
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
Acquired by url
important point:
Self . preferredContentSize = CGSizeMake ( 0 , 110 ); // set the height 110
// indent iOS10 invalid after
- (UIEdgeInsets)widgetMarginInsetsForProposedMarginInsets:(UIEdgeInsets)defaultMarginInsets{
return UIEdgeInsetsZero;
}