├── .gitignore
├── .travis.yml
├── Changelog.md
├── GC Manager
├── GCMConstants.h
├── GCMMultiplayer.h
├── GCMMultiplayer.m
├── GameCenterManager Mac-Bridging-Header.h
├── GameCenterManager-Bridging-Header.h
├── GameCenterManager.h
├── GameCenterManager.m
├── Multiplayer.swift
├── NSDataAES256.h
├── NSDataAES256.m
├── Reachability.h
├── Reachability.m
└── Referee.swift
├── GameCenterManager Mac
├── GameCenterManager Mac-Info.plist
├── GameCenterManager Mac-Prefix.pch
├── GameCenterManager Mac.entitlements
├── MacViewController.h
├── MacViewController.m
├── Storyboard.storyboard
├── en.lproj
│ ├── Credits.rtf
│ └── InfoPlist.strings
└── main.m
├── GameCenterManager tvOS
├── AppDelegate.h
├── AppDelegate.m
├── Base.lproj
│ └── Storyboard_tvOS.storyboard
├── GameCenterManager-Prefix.pch
├── Info.plist
├── ViewController.h
├── ViewController.m
├── main.m
└── tvOSImages.xcassets
│ ├── Brand Assets.brandassets
│ ├── App Icon - Large.imagestack
│ │ ├── Back.imagestacklayer
│ │ │ ├── Content.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── GCMLargeIconBottom.png
│ │ │ └── Contents.json
│ │ ├── Brackets.imagestacklayer
│ │ │ ├── Content.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── GCMLargeIconBrackets.png
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ ├── Front.imagestacklayer
│ │ │ ├── Content.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── GCMLargeIconTop.png
│ │ │ └── Contents.json
│ │ └── Middle.imagestacklayer
│ │ │ ├── Content.imageset
│ │ │ ├── Contents.json
│ │ │ └── GCMLargeIconMiddle.png
│ │ │ └── Contents.json
│ ├── App Icon - Small.imagestack
│ │ ├── Back.imagestacklayer
│ │ │ ├── Content.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── GCMSmallIconBottom.png
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ ├── Front.imagestacklayer
│ │ │ ├── Content.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ └── GCMSmallIconTop.png
│ │ │ └── Contents.json
│ │ └── Middle.imagestacklayer
│ │ │ ├── Content.imageset
│ │ │ ├── Contents.json
│ │ │ └── GCMSmallIconMiddle.png
│ │ │ └── Contents.json
│ ├── Contents.json
│ └── Top Shelf Image.imageset
│ │ ├── Contents.json
│ │ └── LaunchImage.png
│ ├── Contents.json
│ ├── LaunchImage.launchimage
│ ├── Contents.json
│ └── LaunchImage.png
│ └── Leaderboard.gcleaderboard
│ ├── Contents.json
│ └── Poster.imagestack
│ ├── Back.imagestacklayer
│ ├── Content.imageset
│ │ ├── Contents.json
│ │ └── PosterBack.png
│ └── Contents.json
│ ├── Contents.json
│ ├── Front.imagestacklayer
│ ├── Content.imageset
│ │ ├── Contents.json
│ │ └── PosterFront.png
│ └── Contents.json
│ └── Middle.imagestacklayer
│ ├── Content.imageset
│ └── Contents.json
│ └── Contents.json
├── GameCenterManager.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ │ ├── GameCenterManager.xccheckout
│ │ └── IDEWorkspaceChecks.plist
│ └── xcuserdata
│ │ ├── Spencers.xcuserdatad
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
│ │ ├── nihalahmed.xcuserdatad
│ │ └── WorkspaceSettings.xcsettings
│ │ └── samspencer.xcuserdatad
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
└── xcuserdata
│ ├── Spencers.xcuserdatad
│ ├── xcdebugger
│ │ ├── Breakpoints.xcbkptlist
│ │ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ │ ├── GameCenterManager Mac.xcscheme
│ │ ├── GameCenterManager.xcscheme
│ │ └── xcschememanagement.plist
│ ├── nihalahmed.xcuserdatad
│ └── xcschemes
│ │ ├── GameCenterManager.xcscheme
│ │ └── xcschememanagement.plist
│ └── samspencer.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ ├── GameCenterManager Mac.xcscheme
│ ├── GameCenterManager.xcscheme
│ └── xcschememanagement.plist
├── GameCenterManager
├── AppDelegate.h
├── AppDelegate.m
├── GameCenterManager-Info.plist
├── GameCenterManager-Prefix.pch
├── ViewController.h
├── ViewController.m
├── en.lproj
│ ├── InfoPlist.strings
│ └── Storyboard_iPhone.storyboard
└── main.m
├── Images.xcassets
├── AppIcon.appiconset
│ ├── AppIcon29x29.png
│ ├── AppIcon29x29@2x.png
│ ├── AppIcon40x40@2x.png
│ ├── AppIcon60x60@2x.png
│ ├── Contents.json
│ ├── Icon.png
│ └── Icon@2x.png
├── Contents.json
├── GCSymbol.imageset
│ ├── Contents.json
│ ├── GK Icon-512.png
│ └── GK Icon-512@2x.png
├── LaunchImage.launchimage
│ ├── Contents.json
│ ├── Default-568h@2x.png
│ ├── Default.png
│ ├── Default@2x-1.png
│ └── Default@2x.png
└── MacAppIcon.appiconset
│ ├── Contents.json
│ ├── GK Icon-128.png
│ ├── GK Icon-128@2x.png
│ ├── GK Icon-16.png
│ ├── GK Icon-16@2x.png
│ ├── GK Icon-256.png
│ ├── GK Icon-256@2x.png
│ ├── GK Icon-32.png
│ ├── GK Icon-32@2x.png
│ ├── GK Icon-512.png
│ └── GK Icon-512@2x.png
├── Images
├── GameBanner.png
├── GameBanner.psd
├── Interface.png
└── Interface.psd
├── License.md
├── README.md
└── travis
├── ios
└── build.sh
└── osx
└── build.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | GameCenterManager.xcodeproj/project.xcworkspace/xcuserdata
2 | GameCenterManager.xcodeproj/xcuserdata
3 |
4 | *.xcuserstate
5 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 |
2 | language: objective-c
3 | compiler: clang
4 | osx_image: xcode7.2
5 | sudo: truev
6 | matrix:
7 | include:
8 | - os: osx
9 | compiler: clang
10 | env: TARGET="osx"
11 | - os: osx
12 | compiler: clang
13 | env: TARGET="ios"
14 | script:
15 | - travis/$TARGET/build.sh
16 | git:
17 | depth: 10
18 |
--------------------------------------------------------------------------------
/Changelog.md:
--------------------------------------------------------------------------------
1 | #Changelog
2 |
3 |
4 | Version 5.3 |
5 |
6 | Updated GameCenterManager for iOS 7 and OS X 10.9 Improved Singleton. New features and enhancements.
7 |
8 | - Added compiler checks for ARC, iOS 7, and OS X Mavericks 10.9.
9 | - Deprecated initGameCenter. Use setupManagerAndSetShouldCryptWithKey: or setupManager instead.
10 | - Encryption of local data is no longer required. Use the new setup methods to define encrytion parameters, or to turn it OFF.
11 | - Improved Singleton - Removed nil object creation and replaced allocWithZone: with alloc. Improved private init method.
12 | - Added three new methods for presenting GameKit ViewControllers
13 | - New properties to handle encryption.
14 | - Improved sample apps
15 |
16 | |
17 |
18 | Version 5.2 |
19 |
20 | Consolidated the GameCenterManager for iOS and OS X classes into one class. Improved Singleton. 64-bit compatible. Bug fixes and enhancements. Documentation improvements.
21 |
22 | - Combined the GameCenterManager classes for Mac and iOS and combined them into one single class.
23 | - Deprecated delegate methods with new (better) names and parameters. Now some delegates pass actual GKScore and GKAchievement objects instead of NSDictionaries with those objects.
24 | - Moved project files around for better organization.
25 | - Improved Singleton - now uses GCD dispatch once to properly setup. Improved setup.
26 | - 64-bit compatible - added arm64 architecture to the build settings and updated the encryption files for 64-bit
27 | - Documentation improvements - added more extensive documentation for all methods and properties. Now documentation can be viewed with Xcode 5.0's built-in documentation viewer / Quick Help features.
28 | - Bug fixes and enhancements
29 | - New properties
30 |
31 | |
32 |
33 | Version 5.1 |
34 |
35 | This update adds support for iOS 7, makes improvements to the iOS & Mac OS X demo apps, fixes bugs with error reporting, improves player data methods, and makes some breaking changes to resetting achievements.
36 |
37 | - Major improvements to the demo apps including new UI and Icons
38 | - Limited iOS 7 support. The project runs on iOS 7, but the classes are not fully optimized for iOS 7. A new branch will be created soon which has specific iOS 7 changes.
39 | - Fixed a bug where checking for GameCenter availability would return NO, but wouldn't deliver an error message.
40 | - Deprecated gameCenterManager:resetAchievements: delegate method in favor of a completion handler now available on the resetAchievements: method. The gameCenterManager:resetAchievements: delegate method is no longer called
41 | - Fixed a bug where resetting achievements may not work
42 | - Cleaned code, minor improvements to code
43 |
44 | |
45 |
46 | Version 5.0 |
47 |
48 | This update adds support for Game Center on Mac OS X and makes improvements to the iOS demo app. Improvements have also been made to error reporting, challenges, and player data.
49 |
50 | - Adds support for Mac OS X. Use the GameCenterManager Mac folder to access resources for the OS X compatible version of GameCenterManager. This also includes an OS X demo app that works with the iOS demo app.
51 | - Improved Game Center Error Reporting. The gameCenterManager: error: delegate method now passes an NSError as the error parameter instead of an NSDictionary. New GCMError constants are provided as error codes in each error.
52 | - Makes improvements to thread management and background tasks - heavy background tasks like syncing to GameCenter (which involve networking, encryption, and file system management) are performed on the background thread and will continue to finish the process even after the user exits the app.
53 | - Fixed bug where the getChallenges method would always return nil. The getChallenges: method no longer returns a value - instead it uses a completion handler and delegate methods.
54 | - Added a new method to retrieve a player's profile picture, localPlayerPhoto:(void (^)(UIImage *playerPhoto))handler
55 | - Fixed bug where achievements may not sync, esp. after resetting achievements.
56 | - Reorganized code
57 |
58 | Known Issues Resetting achievements causes them to reset on Game Center, but the cache remains locally. This cahce eventually causes all achievement data to be uploaded to Game Center.
59 | |
60 |
61 |
62 |
63 |
64 | Version 4.4 |
65 |
66 | Fixed issue where new GKLeaderboard object's category property was being set to the saved GKLeaderboard object. Pull Request from michaelpatzer |
67 |
68 | Version 4.3 |
69 |
70 | Added support for Game Center Leaderboard score orders. When submitting scores you can now set the score order from High to Low or Low to High using new Game Center types: GameCenterSortOrderHighToLow, GameCenterSortOrderLowToHigh. Pull Request from michaelpatzer |
71 |
72 | Version 4.2 |
73 |
74 | Fixed issue where GameCenter Manager would fail to handle authentication after calling the authenticateHandler. Pull Request by Jonathan Swafford |
75 |
76 | Version 4.1 |
77 |
78 | Fixed issue where GameCenter Manager would fail to report achievements and scores even if Game Center was available. |
79 |
80 | Version 4.0 |
81 |
82 | This update makes massive improvements to the flow and performance of code, updates Objective-C compiler and build settings, redesigns the demo app, and adds three new methods and eight new delegate methods.
83 |
84 | - Removed NSNotifications and replaced with delegate methods. This makes integration with current projects easier and faster; it is also more reliable. See the Delegates section of this document for more.
85 | - Improved Game Center Availability Checking and Error Reporting. Now check for the availablity of Game Center with the checkGameCenterAvailability method.
86 | - Makes improvements to thread switching - now UI tasks are performed on the main thread. Previously they were performed on a background thread for Game Center.
87 | - In depth error reporting for Game Center errors and availability issues.
88 | - The demo app has undergone massive improvements, including many interface improvements. To eliminate redundancy, the iPad part of the Demo App has been removed - GameCenter Manager still works with iPad though.
89 | - Code cleanup and reorganization to make it easier on the eyes.
90 | - Upgrades ARMV6 assembler codegen from THUMB to ARM
91 | |
93 |
94 |
95 |
96 |
97 |
98 | Version 3.1 |
99 |
100 | Improved error reporting and reorganized files to remove duplicates. Added a way to retrieve challenges. Converted old demo app files to support iOS 5+ - now using storyboards intead of XIB. |
101 |
102 | Version 3.0 |
103 |
104 | Added ARC compatibility. All files are now ready to be used with ARC. Many methods have been updated that were depreciated in iOS 6.0. The demo app has undergone massive improvements, including many interface improvements, iPhone 5 support, a new icon, and better GC status reporting. |
105 |
106 | Version 2.3 |
107 |
108 | Fixed leaderboard synchronization bug where it would crash if user didn't submit a score previously. |
109 |
110 | Version 2.2 |
111 |
112 | Fixed leaderboard synchronization bug where it would only sync the default leaderboard. |
113 |
114 | Version 2.1 |
115 |
116 | Fixed NSNotification Bug |
117 |
118 | Version 2.0 |
119 |
120 | Added encryption, fixed synchronization bug and added comments and readme |
121 |
122 | Version 1.0 |
123 |
124 | Initial Commit |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/GC Manager/GCMConstants.h:
--------------------------------------------------------------------------------
1 | //
2 | // GCMConstants.h
3 | // GameCenterManager
4 | //
5 | // Created by Sam Spencer on 11/23/15.
6 | // Copyright © 2015 NABZ Software. All rights reserved.
7 | //
8 |
9 | #ifndef GCMConstants_h
10 | #define GCMConstants_h
11 |
12 | #if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted)
13 | #define GCM_FINAL __attribute__((objc_subclassing_restricted))
14 | #else
15 | #define GCM_FINAL
16 | #endif
17 |
18 |
19 | /// Leaderboard sort order. Use this value when submitting new leaderboard scores. This value should match the value set in iTunes Connect for the speicifed leaderboard.
20 | typedef enum GameCenterSortOrder {
21 | /// Scores are sorted highest to lowest. Higher scores are on the top of the leaderboard
22 | GameCenterSortOrderHighToLow,
23 | /// Scores are sorted lowest to highest. Lower scores are on the top of the leaderboard
24 | GameCenterSortOrderLowToHigh
25 | } GameCenterSortOrder;
26 |
27 | enum {
28 | /// An unknown error occurred
29 | GCMErrorUnknown = 1,
30 | /// GameCenterManager is unavailable, possibly for a variety of reasons
31 | GCMErrorNotAvailable = 2,
32 | /// The requested feature is unavailable on the current device or iOS version
33 | GCMErrorFeatureNotAvailable = 3,
34 | /// There is no active internet connection for the requested operation
35 | GCMErrorInternetNotAvailable = 4,
36 | /// The achievement data submitted was not valid because there were missing parameters
37 | GCMErrorAchievementDataMissing = 5,
38 | /// The multiplayer data could not be sent with the specified connection type because it was too large
39 | GCMErrorMultiplayerDataPacketTooLarge = 6
40 | };
41 | /// GameCenterManager error codes that may be passed in a completion handler's error parameter
42 | typedef NSInteger GCMErrorCode;
43 |
44 | /// GameCenter availability status. Use these statuss to identify the state of GameCenter's availability.
45 | typedef enum GameCenterAvailability {
46 | /// GameKit Framework not available on this device
47 | GameCenterAvailabilityNotAvailable,
48 | /// Cannot connect to the internet
49 | GameCenterAvailabilityNoInternet,
50 | /// Player is not yet signed into GameCenter
51 | GameCenterAvailabilityNoPlayer,
52 | /// Player is not signed into GameCenter, has declined to sign into GameCenter, or GameKit had an issue validating this game / app
53 | GameCenterAvailabilityPlayerNotAuthenticated,
54 | /// Player is signed into GameCenter
55 | GameCenterAvailabilityPlayerAuthenticated
56 | } GameCenterAvailability;
57 |
58 | #endif /* GCMConstants_h */
59 |
--------------------------------------------------------------------------------
/GC Manager/GCMMultiplayer.h:
--------------------------------------------------------------------------------
1 | //
2 | // GCMMultiplayer.h
3 | // GameCenterManager
4 | //
5 | // Created by Sam Spencer on 11/23/15.
6 | // Copyright © 2015 NABZ Software. All rights reserved.
7 | //
8 |
9 | #import