Gamecenter issue

Monkey Targets Forums/iOS/Gamecenter issue

hobo(Posted 2012) [#1]
Just a simple configuration issue I think.

Trying to get gamecenter intialising in my code.

So have been following the very useful hints and tips on the forum and picked up the gamecenter code:

http://www.rawkins.com/gamecenter.zip

I downloaded and placed the gamecenter code (from this forum) in my main folder in this directory structure:

mygame/gamecenter/GameCenter.monkey
mygame/gamecenter/native/ios.cpp


Then in my main.monkey file I added:

Import gamecenter.GameCenter


When I build and target iOS i get:

Ld build/Release-iphonesimulator/MonkeyGame.app/MonkeyGame normal i386
    cd /Users/user/Documents/MonkeyPro56/monkeycode/myGameHD/myGame/myGame.build/ios
    setenv MACOSX_DEPLOYMENT_TARGET 10.6
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/user/flex_sdk/bin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/user/Documents/MonkeyPro56/monkeycode/myGameHD/myGame/myGame.build/ios/build/Release-iphonesimulator -F/Users/user/Documents/MonkeyPro56/monkeycode/myGameHD/myGame/myGame.build/ios/build/Release-iphonesimulator -filelist /Users/user/Documents/MonkeyPro56/monkeycode/myGameHD/myGame/myGame.build/ios/build/MonkeyGame.build/Release-iphonesimulator/MonkeyGame.build/Objects-normal/i386/MonkeyGame.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000 -framework Foundation -framework UIKit -framework CoreGraphics -framework OpenGLES -framework QuartzCore -framework OpenAL -framework AudioToolbox -framework AVFoundation -o /Users/user/Documents/MonkeyPro56/monkeycode/myGameHD/myGame/myGame.build/ios/build/Release-iphonesimulator/MonkeyGame.app/MonkeyGame
Undefined symbols for architecture i386:
  "_GKPlayerAuthenticationDidChangeNotificationName", referenced from:
      -[GameCenter registerForAuthenticationNotification] in main.o
  "_OBJC_CLASS_$_GKAchievement", referenced from:
      objc-class-ref in main.o
  "_OBJC_CLASS_$_GKAchievementViewController", referenced from:
      objc-class-ref in main.o
  "_OBJC_CLASS_$_GKLeaderboardViewController", referenced from:
      objc-class-ref in main.o
  "_OBJC_CLASS_$_GKLocalPlayer", referenced from:
      objc-class-ref in main.o
  "_OBJC_CLASS_$_GKScore", referenced from:
      objc-class-ref in main.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)


TRANS FAILED: TRANS Failed to execute 'xcodebuild -configuration Release -sdk iphonesimulator', return code=16640
** BUILD FAILED **
The following build commands failed:
	Ld build/Release-iphonesimulator/MonkeyGame.app/MonkeyGame normal i386
(1 failure)

Process Complete


I have spent all morning trying to come up with a solution throwing gamecenter.h in various places and renaming, rebuilding, editing the Xcode project to include gamecenter but no solution and traditionally I'm always missing something obvious.

Does anyone have an idea?

Thanks.


benmc(Posted 2012) [#2]
After you do the initial build, as you have, you may want to try to open the newly created project (tho broken) in XCode and include the gamecenter required libraries, then build again.

This might help identify those libraries (I forgot what they were)

http://developer.apple.com/library/ios/#DOCUMENTATION/NetworkingInternet/Conceptual/GameKit_Guide/GameCenterOverview/GameCenterOverview.html

Here it is on StackOverflow (same errors and the libraries required)

http://stackoverflow.com/questions/5398660/gamekit-gamecenter-i386-problem


hobo(Posted 2012) [#3]
It worked.

Thanks benmc.

Opened the xcode project and linked the gamecenter library.

Also set it up in the targets ios folder so I dont have to do it again!