Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9065079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:24:50+00:00 2026-06-16T16:24:50+00:00

I’m having a bit of a nightmare trying to implement the ability to have

  • 0

I’m having a bit of a nightmare trying to implement the ability to have two players playing against each other on my iPhone app through Game Center.

I am simply trying to access a function within GameCenterManager.m from a different .m file that I have. In my racetohundredViewController.h file I have:

#import <UIKit/UIKit.h>
#import "startPage.h"
#import "GameCenterManager.h"
#import <GameKit/GameKit.h>

@interface racetohundredViewController : UIViewController <UIActionSheetDelegate,     GKLeaderboardViewControllerDelegate, GameCenterManagerDelegate>

{
    GameCenterManager *gcManager;
    BOOL gameIsMultiplayer;
    double randomHostNumber;
}
@property (retain, nonatomic) GameCenterManager *gcManager;

in my corresponding .m file I have:

@interface racetohundredViewController ()
@end

@implementation racetohundredViewController
@synthesize gcManager;

- (void)generateAndSendHostNumber;
{
    NSLog(@"Generate and send host number");
    randomHostNumber = arc4random();
    NSString *randomNumberString = [NSString stringWithFormat: @"$Host:%f", randomHostNumber];
    NSLog(@"the random number string is: %@", randomNumberString);
    [self.gcManager testString];
    [self.gcManager sendStringToAllPeers:randomNumberString reliable: YES];
}

- (void)viewDidLoad
{
[self generateAndSendHostNumber];
}

It’s the [self.gcManager testString]; and [self.gcManager sendStringToAllPeers:randomNumberString reliable: YES]; that are not being called. They were before, I have clearly messed it up somehow. I can see the NSLog for the random number string.

In my GameCenterManager.h file I have (including some bits unrelated to this problem):

#import <Foundation/Foundation.h>
#import <GameKit/GameKit.h>

@class GKLeaderboard, GKAchievement, GKPlayer;
@protocol GameCenterManagerDelegate <NSObject>
@optional
- (void) processGameCenterAuthentication: (NSError*) error;
- (void) scoreReported: (NSError*) error;
- (void) reloadScoresComplete: (GKLeaderboard*) leaderBoard error: (NSError*) error;
- (void) achievementSubmitted: (GKAchievement*) ach error:(NSError*) error;
- (void) achievementResetResult: (NSError*) error;
- (void) mappedPlayerIDToPlayer: (GKPlayer*) player error: (NSError*) error;
- (void) receivedData:(NSDictionary *)dataDictionary;
@end

@interface GameCenterManager : NSObject <GameCenterManagerDelegate>
{
    id <GameCenterManagerDelegate, NSObject> delegate;
    NSMutableDictionary* earnedAchievementCache;
    id matchOrSession;
}

//This property must be atomic to ensure that the cache is always in a viable state...
@property (retain) NSMutableDictionary* earnedAchievementCache;
@property (nonatomic, strong) id <GameCenterManagerDelegate, NSObject> delegate;
@property(nonatomic, strong) id matchOrSession;

+ (BOOL) isGameCenterAvailable;
- (void) authenticateLocalUser;
- (void)sendStringToAllPeers:(NSString *)dataString reliable:(BOOL)reliable;
- (void)sendString:(NSString *)dataString toPeers:(id)peers reliable: (BOOL)reliable;
-(void)testString;

and finally a cut down version of the .m file for GameCenterManager:

#import "GameCenterManager.h"
#import <GameKit/GameKit.h>
@implementation GameCenterManager
@synthesize earnedAchievementCache;
@synthesize delegate;
@synthesize matchOrSession;


-(void)testString
{
    NSLog(@"THIS IS A TEST");
}

I could post code about sendString too but the principle is that even with the basic testString function it is not calling it.

Am I missing something very obvious here? It seems when I step through the code it will highlight the function in the .h file of GameCenterManager, but it won’t then display the NSLog as I request.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:24:51+00:00Added an answer on June 16, 2026 at 4:24 pm

    My best guess would be that self.gcManager is nil. Where do you instantiate your GameCenterManager?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.