最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

IOS如何在Host App 與 App Extension 之間發(fā)送通知

 更新時間:2016年03月03日 11:47:33   作者:Saviors  
這篇文章主要介紹了IOS如何在Host App 與 App Extension 之間發(fā)送通知 的相關(guān)資料,需要的朋友可以參考下

如何從你的一個App發(fā)送通知給另一個App? (例:搜狗輸入法下載皮膚完成后使用皮膚) 注:搜狗輸入法是App、而鍵盤是Extension

當(dāng)你為你的App 添加 App Extension時,如果想在App 發(fā)送通知給 Extension或許這篇文章可以幫助你。

了解更多內(nèi)容

// 發(fā)送通知
- (void)postNotificaiton {
CFNotificationCenterRef notification = CFNotificationCenterGetDarwinNotifyCenter ();
CFNotificationCenterPostNotification(notification, CFSTR("<notificaiton name>"), NULL,NULL, YES);
} 
// 接收通知
- (void)receiveNotification {
CFNotificationCenterRef notification = CFNotificationCenterGetDarwinNotifyCenter (); 
CFNotificationCenterAddObserver(notification, (__bridge const void *)(self), observerMethod,CFSTR("<notificaiton name>"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately); 
}
void observerMethod (CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo)
{ 
// Your custom work 
} 
// 移除通知
- (void)removeNotification
{
CFNotificationCenterRef notification = CFNotificationCenterGetDarwinNotifyCenter ();
CFNotificationCenterRemoveObserver(notification, (__bridge const void *)(self), CFSTR("<notificaiton name>"), NULL);
}

以上內(nèi)容給大家簡單介紹了IOS如何在Host App 與 App Extension 之間發(fā)送通知的相關(guān)內(nèi)容,希望對大家有所幫助!

相關(guān)文章

最新評論

建阳市| 莱西市| 鄱阳县| 嘉鱼县| 吴旗县| 桑植县| 阿合奇县| 靖安县| 巴彦淖尔市| 六安市| 松原市| 兴化市| 新密市| 兰坪| 洛隆县| 保定市| 汉阴县| 休宁县| 广东省| 左云县| 五寨县| 宁晋县| 台湾省| 华容县| 长寿区| 皮山县| 深州市| 恩施市| 天门市| 汨罗市| 濮阳县| 神池县| 晴隆县| 金乡县| 沭阳县| 高台县| 米泉市| 临安市| 肥东县| 陈巴尔虎旗| 永州市|