nsnotificationcenter

calling a method when a particular CCAnimationFrame is displayed using CCAnimationFrameDisplayedNotification

拜拜、爱过 提交于 2019-12-11 04:46:23
问题 I would like to call a method that rotates a sprite when a particular frame in displayed. I got a few ideas from this post but I am having issues as to how I should implement it. How would I define my dictionary for accessing 3rd frame and link it to the selector? Below is what I've done. Please note that it's work-in-progress. -(id) init { // always call "super" init // Apple recommends to re-assign "self" with the "super's" return value if( (self=[super init]) ) { CCSpriteBatchNode*

big problem with the NSNotificationCenter, it doesn't update the display of the target

ぃ、小莉子 提交于 2019-12-11 03:55:36
问题 Help, I'm deperate..i can't continue my app because of this: I have setup one message between 2 of my cocoa objective-c clases, the main appdelegate is messaging a view through NSNotificationCenter the view receives indeed the notification but somehow it can't update the controls visible on the view.. it's like it can't find the proper instance or something. here's my code: mainapp (where the appdelegate messages my view): helloKey = @"0"; helloString = @"mymessage"; values =

How to receive ALAssetsLibraryChangedNotification in iOS 4 while in background

你。 提交于 2019-12-11 03:49:59
问题 I would like to register my iOS 4 app as an observer for ALAssetsLibraryChangedNotification and receive notifications when changes happen to the camera roll and photo library. The most obvious scenario is: 1) My app enumerates photo contents using ALAssetsLibrary. 2) Leave my app (goes into background) and launch the camera app. 3) Take a picture. 4) Leave the camera app and return to my app. I was hoping the ALAssetsLibraryChangedNotification would be delivered when my app returned to the

UIView disappears when keyboard pops up for UITextField

这一生的挚爱 提交于 2019-12-11 03:41:44
问题 I have an UITextField inside of a container view, when the keyboard pops up the container view disappears. In the same container view is a UICollectionView , whose custom cells each contains a UITextField and the keyboard works just fine for them. I printed out the frame of the container view in the animation function that is called by keyboardWillShow and the container view's frames are the same for both cases, so it looks like the container view just disappears (instead of "not moved" as i

PushNotifications iOS 7 not working when user taps on icon

你说的曾经没有我的故事 提交于 2019-12-11 02:27:11
问题 I have the methods below to handle push notifications. They work perfect when the app is running and I do receive notifications when the app is in the background. When a user taps the icon however it opens the app but my UICollection view is not reloaded the way it is when a user receives the notification when the app is running. -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { UIApplicationState state = [application applicationState]; if

NSNotification in iphone

独自空忆成欢 提交于 2019-12-10 17:36:11
问题 i am sending NSSNotifcation to another view controller in iPhone app but its observer method getting notified two times how its possible can any one guide me i have use this code to post notification [[NSNotificationCenter defaultCenter] postNotificationName:@"updateStatusOnFacebook" object:nil userInfo:nil]; and added observer [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(postToWall) name:@"updateStatusOnFacebook" object:nil]; 回答1: Have you added the observer

Reachability change notification should be called only once

依然范特西╮ 提交于 2019-12-10 16:06:28
问题 I'm using Reachability in my swift project. I had below code in AppDelegate NSNotificationCenter.defaultCenter().addObserver(self, selector: "reachabilityChanged:", name: ReachabilityChangedNotification, object: reachability) reachability.startNotifier() It does call func reachabilityChanged(note: NSNotification) { } But my problem is that, it is being called for all the request. That is, I'm loading images from the server, so when network reachability get's change this is method get's call

NSUserNotificationCenter.defaultUserNotificationCenter() returns None in python

纵饮孤独 提交于 2019-12-10 15:10:44
问题 I am trying to connect to the Mountain Lion notification center via python. I've installed pyobjc and am following the instructions here and here. Also see: Working with Mountain Lion's Notification Center using PyObjC Here's my code: import Foundation, objc import AppKit import sys NSUserNotification = objc.lookUpClass('NSUserNotification') NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter') def notify(title, subtitle, info_text, delay=0, sound=False, userInfo={}): """

How write unit test for receiving nsnotification asynchronous?

送分小仙女□ 提交于 2019-12-10 13:47:33
问题 I call rest web servic with completion handler and if succeed I send NSNotification. The problem is how to write unit test to assert that the notification is sent in case of success. Any help will be appreciated. 回答1: You can add an expectation for the notification: expectationForNotification("BlaBlaNotification", object: nil) { (notification) -> Bool in // call the method that fetches the data sut.fetchData() waitForExpectationsWithTimeout(5, handler: nil) But personally I would split this

iOS : Why our app sometimes doesn't show in the Notification Center?

谁说胖子不能爱 提交于 2019-12-10 11:19:16
问题 There are 3 kinds of situations about this problem. During the development, I can restart the iPhone and reinstall the app to solve this problem. At first, this problem often occurs in the jailbreak iPhone, so we think that there may be something wrong with the Provisioning Profiles. But now, more and more users complain about this (could not receive push), who use the normal iPhone (not jailbreak) and download our app from the App Store. So, I'm confused, and a little worried, about why our