Thursday 15 March 2012

Use Block in Objective C to find out if a BOOL has been set? -


I'm new to OBJ-C. I have a class that sets a var boolean for YOS if it Successful (Game Center Login = Successful), so what would be good to do this, in any way, there is a listener for the listener who hears when it is yes and then executes some code for what I do Use a block? I am also using Sparrow Framework

My code in my GameCenter.m file

  - (zero) setup {gameCenterAuthenticationComplete = NO; If (! IsGameCenterAPIAvailable ()) // // Game Center is not available NSLog (@ "Game Center is not available."); } And {nslog (@ "game center is available."); __Week type (self) weak Self = self; // Maintaining cycle error GKLocalPlayer * localPlayer = [GKLocalPlayer localPlayer]; // localPlayer public GKLocalPlayer __weak GKLocalPlayer * Vulnerable Player = Local Player; / Maintaining cycle error deletes weak player AuthenthenticateHandler = ^ (UIViewController * viewController, NSError * error) {if (viewController! = Null) {[weakSelf showAuthenticationDialogWhenReasonable: viewController]; } And if (weak player. Authentic) {[weak self certified player: weak player]; } And {{Weak gameman disabled]; }}; }} - (void) showAuthenticationDialogWhen appropriate: (UIViewController *) controller {[[UIApplication shared application] delegate] window] root view controller] PresentViewController: controller animated: Yes Full minus]; } - (void) certified player (Jikelokelpleyr *) Player {Anselog (@ "% @% @% @" player. Pleyraidi player. DisplayName, Kiladhiklias); GameCenterAuthenticationComplete = Yes; } - (zero) disableGameCenter {}   

But I should know from a different object that if that game center entrepreneurship is low then yes.

You can use a representative pattern, it is easy to use from KVO or local information and its There is a lot to use in Objec-C.

Information should be used only under specific circumstances (like when you do not know who wants to listen or when more than 1 listeners).

One block will work here but the representative actually does the same.

No comments:

Post a Comment