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

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

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

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

當(dāng)你為你的App 添加 App Extension時(shí),如果想在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)容給大家簡(jiǎn)單介紹了IOS如何在Host App 與 App Extension 之間發(fā)送通知的相關(guān)內(nèi)容,希望對(duì)大家有所幫助!

相關(guān)文章

最新評(píng)論

沈阳市| 花垣县| 敦化市| 荆门市| 南昌市| 馆陶县| 宁陵县| 新乐市| 库车县| 海阳市| 武清区| 新田县| 湘乡市| 阿拉尔市| 略阳县| 甘孜县| 海口市| 章丘市| 靖州| 阳泉市| 新安县| 临海市| 凌源市| 阿坝县| 专栏| 平泉县| 信丰县| 宜丰县| 通江县| 丹棱县| 平武县| 昭平县| 平邑县| 张家界市| 从化市| 瑞安市| 准格尔旗| 繁峙县| 永登县| 东方市| 溧阳市|