GREE Integration endup with Errors - iphone

I integrated GREE in an iOS application(demo) and after a day long hard work the code was good enough to go, that executed properly and produced some UI response but, pity that was no worthy, check:
Also I have something in my console;
2012-12-04 09:52:22.721 GreeHelloSample[1295:1bb03] GreeJSAbstractStateCommand:name must be overloaded in subclasses.
2012-12-04 09:52:22.724 GreeHelloSample[1295:1bb03] GreeJSAsyncCommand:name must be overloaded in subclasses.
2012-12-04 09:52:22.725 GreeHelloSample[1295:1bb03] GreeJSLoadAsynchronousCommand:name must be overloaded in subclasses.
2012-12-04 09:52:22.997 GreeHelloSample[1295:1bb03] [Gree][GreePlatform.m:381] Initialized Gree Platform SDK 3.4.0 (Build release/v3.4.0_public_189)
2012-12-04 09:52:24.589 GreeHelloSample[1295:1bb03] didLogoutUser
2012-12-04 09:52:25.003 GreeHelloSample[1295:1bb03] greePlatformWillShowModalView
But I am tired and unable to track What went wrong, now? So, help me.
EDIT 1:
Here is All related code I wrote:
.h
#import <UIKit/UIKit.h>
#import "GreePlatform.h"
#import "GreePlatformSettings.h"
#define kGreeApplicationID #"XXXXX"
#define kGreeConsumerKey #"XXXXXXXXXXXX"
#define kGreeConsumerSecret #"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
#class GHSViewController;
#interface GHSAppDelegate : UIResponder <UIApplicationDelegate, GreePlatformDelegate>
#property (retain, nonatomic) UIWindow *window;
#property (retain, nonatomic) GHSViewController *viewController;
#end
.m
#import "GHSAppDelegate.h"
#import "GHSViewController.h"
#implementation GHSAppDelegate
- (void)dealloc
{
[_window release];
[_viewController release];
[super dealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
self.viewController = [[[GHSViewController alloc] initWithNibName:#"GHSViewController" bundle:nil] autorelease];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
NSDictionary* settings = [NSDictionary dictionaryWithObjectsAndKeys:GreeDevelopmentModeSandbox, GreeSettingDevelopmentMode, nil];
[GreePlatform initializeWithApplicationId:kGreeApplicationID
consumerKey:kGreeConsumerKey
consumerSecret:kGreeConsumerSecret
settings:settings
delegate:self];
[GreePlatform handleLaunchOptions:launchOptions application:application];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
[GreePlatform shutdown];
}
#pragma mark - GreePlatformDelegate
/**
* Sent to the receiver when Gree will show a modal view (dashboard, login dialogs,
* etc.) that will interrupt your application.
* #note It is recommended that you suspend your application logic here.
*/
-(void)greePlatformWillShowModalView:(GreePlatform*)platform{
NSLog(#"greePlatformWillShowModalView");
}
/**
* Sent to the receiver when Gree has dismissed a modal view (dashboard, login dialogs,
* etc.) that was interrupting your application.
* #note It is recommended that you resume your application logic here.
*/
-(void)greePlatformDidDismissModalView:(GreePlatform*)platform{
NSLog(#"greePlatformDidDismissModalView");
}
/**
* Sent to the receiver when your application's user logs in to the Gree Platform.
*/
-(void)greePlatform:(GreePlatform*)platform didLoginUser:(GreeUser*)localUser{
NSLog(#"didLoginUser");
}
/**
* Sent to the receiver when your application's user logs out of the Gree Platform.
*/
-(void)greePlatform:(GreePlatform*)platform didLogoutUser:(GreeUser*)localUser{
NSLog(#"didLogoutUser");
}
/**
#brief Notifies the parameter received when an application starts.
#param params Parameter received when an application starts.
*/
-(void)greePlatformParamsReceived:(NSDictionary*)params{
NSLog(#"greePlatformParamsReceived");
}

Here we go!
I have made one silly mistake to suffer this. Actually I was using Production (Gree Application) ID, for executing my application in sand box. Although Gree Provide different Sandbox ID to run Application in Sandbox environment. Rest of the things are Okay thanks to Gree framework SDK, and specially Showcase*(sample application).

Related

Developing a user interface on iOS environment using GoogleMaps APIv3

I'm new to iOS development. Today, I created a new "SingleViewApplication". I added new Navigation Bars using storyboarding.
Next, I followed the tutorial https://developers.google.com/maps/documentation/ios/start to integrate Google Maps into my project.
However, after adding GoogleMaps, my Navigation Bar has disappeared. Somehow, Google Maps override the interface constructed by using storyboard.
Any suggestions, tutorials, information is kindly appreciated.
The codes are given below:
shareAppDelegate.h
#import <UIKit/UIKit.h>
#interface shareAppDelegate : UIResponder <UIApplicationDelegate>
#property (strong, nonatomic) UIWindow *window;
#end
shareAppDelegate.m
//
// shareAppDelegate.m
// share
//
// Created by neva on 9/17/13.
// Copyright (c) 2013 neva. All rights reserved.
//
#import "shareAppDelegate.h"
#import <GoogleMaps/GoogleMaps.h>
#implementation shareAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[GMSServices provideAPIKey:#"AIzaSyDqbi8tp0DeUHQKASyRyJUqJbOZpMOuuig"];
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
#end
ShareViewController.h
//
// shareViewController.h
// share
//
// Created by neva on 9/17/13.
// Copyright (c) 2013 neva. All rights reserved.
//
#import <UIKit/UIKit.h>
#interface shareViewController : UIViewController
#end
ShareViewController.m
//
// shareViewController.m
// share
//
// Created by neva on 9/17/13.
// Copyright (c) 2013 neva. All rights reserved.
//
#import "shareViewController.h"
#import <GoogleMaps/GoogleMaps.h>
#interface shareViewController ()
#end
#implementation shareViewController{
GMSMapView *mapView_;
}
- (void)loadView {
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = #"Sydney";
marker.snippet = #"Australia";
marker.map = mapView_;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end

Store data after adding items to array

I have an array that you can add items to. Though when I exit the app the records are not saved. How would I do this.
Here is my appdelgate file becausde that is where my NSMutableArray is held
AppDelegate.m:
#import "LSAppDelegate.h"
#import "LSViewController.h"
#import "Patient.h"
#import "PRViewController.h"
#implementation LSAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
Patient *patient = [[Patient alloc]init];
patient.patientName = #"Patient Name";
patient.patientSurname = #"Patient Surname";
patient.patientDoB = #"Patient Date of Birth";
patient.patientHomeNumber = #"Patient Home No";
patient.patientMobileNumber = #"Patient Mobile No";
patient.patientEmail = #"Patient Email Address";
patient.patientAddress = #"Patient Address";
patient.patientPicture = [UIImage imageNamed:#"patientPicture.jpg"];
// Treatments
patient.treatmentName = #"Treatment Name";
patient.treatmentDate = #"Treatment Date";
patient.treatmentType = #"Treatment Type";
self.patients = [[NSMutableArray alloc]
initWithObjects:patient, nil];
// Override point for customization after application launch.
self.viewController = [[LSViewController alloc] initWithNibName:#"LSViewController" bundle:nil];
self.navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
[[UINavigationBar appearance] setTintColor:[UIColor brownColor]];
self.window.rootViewController = self.navController;
[self.window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
}
- (NSString *)applicationDocumentsDirectory {
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
}
#end
so far all i've got is:
- (NSString *)applicationDocumentsDirectory {
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
}
please say if you want more code snippets or files.
To preserve the data, you write it to a file on disk and then load that file when the application is started again.
This is how I have done it in my apps.
Create your array and save it to NSdictonary object
Then store your NSDictonary to your apps documents directory.
When your app launches then find your NSDictonary file object and read the array out of it.
The advantage of using NSDictonary is that you can store multiple arrays (in case you are storing multiple patient info).
Here are some sample answers to get you started.
How to store an NSArray in an NSDictionary?
is it possible to save NSMutableArray or NSDictionary data as file in iOS?
How can we store into an NSDictionary? What is the difference between NSDictionary and NSMutableDictionary?

CLLocation Region Monitoring behaves differently in iOS 5.1 and iOS 6

UPDATE: I am looking for a workaround to this problem in iOS5.1. Currently, I have evidence that this issue in fact is known. However, I think it is related to an updated xcode rather than iOS5.1 actually region monitoring not working.
The simple code below behaves differently between iOS5 and iOS6. It works as expected in iOS6.
But in iOS5, the didEnterRegion callback is only triggered the first time the region is entered. If you exit the region, then re-enter the region, it will not be triggered. If you close and restart the app, entering the region will not trigger the callback.
The difference in behavior was seen on the iOS5 and iOS6 simulators. The broken iOS5 behavior was seen on an iPhone 4S with iOS5. Xcode 4.6 was used. CoreLocation framework was added properly, and locMan is a property of the AppDelegate. A clean new project was created for this test.
Can someone please find a workaround to this problem? The fix needs to use region monitoring, not active location updating.
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#interface AppDelegate : UIResponder <UIApplicationDelegate, CLLocationManagerDelegate>
#property (strong, nonatomic) UIWindow *window;
#property (nonatomic, strong) CLLocationManager *locMan;
#end
// AppDelegate implementation file
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
/// LocationManager
self.locMan = [[CLLocationManager alloc] init];
self.locMan.delegate = self;
CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(40.0, 40.0);
CLLocationDistance distance = 100.0;
CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter:coordinates radius:distance identifier:#"hello"];
[self.locMan startMonitoringForRegion:region];
[self.window makeKeyAndVisible];
return YES;
}
-(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
NSLog(#"didEnterRegion");
}
After leaving this question open for a week, I feel that I've enough evidence that region monitoring is broken in iOS5.1. Time to close out the question.

Trying to make my iphone app universal. Navigation Controller keeps saying Unbalanced calls

have been trying couple of hours now to make my iphone app universal. The mission was successful but have a strange problem. The navigation controller keeps pushing things without even pushing anything. The app doesn't crash but it gives me a message in the console
nested push animation can result in corrupted navigation bar
2012-02-06 10:52:07.701 ##$%^^$[54755:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2012-02-06 10:52:07.704 !##$%^$%#[54755:207] Unbalanced calls to begin/end appearance transitions for <searchEditViewController: 0xc652150>.
and here is how i've set app the whole thing :
![navigation screen shot][1]
here is my code in the AppDelegate_iphone.h
#import <UIKit/UIKit.h>
#import "iPhoneView.h"
#import "AboutUsViewController.h"
#import "FavoritesViewController.h"
#class iPhoneView;
#interface AppDelegate_iPhone : NSObject <UIApplicationDelegate> {
UITabBarController *tabBarController;
UINavigationController *homeNavigationController;
UINavigationController *favouritesNavigationController;
AboutUsViewController *aboutUsViewController;
iPhoneView * search;
FavoritesViewController *favoritesViewController;
UIWindow *window;
}
#property (nonatomic, retain) IBOutlet UIWindow *window;
#property (nonatomic, retain) IBOutlet iPhoneView *search;
#property (nonatomic, retain) FavoritesViewController *favoritesViewController;
#end
and here is on my AppDelegate.m file
#import "AppDelegate_iPhone.h"
#import "iPhoneView.h"
#implementation AppDelegate_iPhone
#synthesize window,search,favoritesViewController;
#pragma mark -
#pragma mark Application lifecycle
- (void)applicationDidFinishLaunching:(UIApplication *)application
{ tabBarController = [[UITabBarController alloc] init];
homeNavigationController = [[UINavigationController alloc] init];
search = [[iPhoneView alloc] init];
[homeNavigationController pushViewController:search animated:NO];
favouritesNavigationController = [[UINavigationController alloc] init];
favoritesViewController = [[FavoritesViewController alloc]init];
[favouritesNavigationController pushViewController:favoritesViewController animated:NO];
aboutUsViewController =[[AboutUsViewController alloc] init];
UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:#"επικοινωνία" image:[UIImage imageNamed:#"aboutus"] tag:0];
aboutUsViewController.tabBarItem = item;
[item release];
UITabBarItem *item2 = [[UITabBarItem alloc] initWithTitle:#"αγαπημένα" image:[UIImage imageNamed:#"favorites"] tag:0];
favouritesNavigationController.tabBarItem = item2;
[item2 release];
NSArray *tabBarControllerCollection = [NSArray arrayWithObjects:homeNavigationController,favouritesNavigationController,aboutUsViewController,nil];
[tabBarController setViewControllers:tabBarControllerCollection animated:NO];
[window addSubview:tabBarController.view];
[window makeKeyAndVisible];
}
- (void)applicationWillResignActive:(UIApplication *)application {
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
*/
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}
- (void)applicationWillTerminate:(UIApplication *)application {
/*
Called when the application is about to terminate.
See also applicationDidEnterBackground:.
*/
}
#pragma mark -
#pragma mark Memory management
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
/*
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
*/
}
- (void)dealloc {
[tabBarController release];
[search release];
[favoritesViewController release];
[favouritesNavigationController release];
[aboutUsViewController release];
[window release];
[super dealloc];
}
#end
OK solved had connected the button 2 times with the same action in IB. Took me 48hours to figure it out!

How to remove UINavigationViewController

I have created one navigationController in name_of_my_appAppDelegate.h...
After the use I want to remove it from the superview...
in my name_of_my_RootViewController I want to call it and remove.
How to call it?
In the NewsPadViewController, how to remove the NavigationController when I finished to use it?
#import <UIKit/UIKit.h>
#class NewsPadViewController;
#interface NewsPadAppDelegate : NSObject <UIApplicationDelegate>{
UIWindow *window;
UINavigationController *navigationController;
}
#property (nonatomic, retain) IBOutlet UIWindow *window;
#property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
#end
and this is the implementation
#import "NewsPadAppDelegate.h"
#import "NewsPadViewController.h"
#implementation NewsPadAppDelegate
#synthesize window;
#synthesize navigationController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[window addSubview:navigationController.view];
[window makeKeyAndVisible];
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
/*
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
/*
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
*/
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
*/
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
/*
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}
- (void)applicationWillTerminate:(UIApplication *)application
{
/*
Called when the application is about to terminate.
Save data if appropriate.
See also applicationDidEnterBackground:.
*/
}
- (void)dealloc
{
[navigationController release];
[window release];
[super dealloc];
}
#end
Check this out: UINavigationController Class Reference.
You probably want something like this:
[name_of_my_RootViewController popToRootViewControllerAnimated:YES];
Or:
[name_of_my_RootViewController.view removeFromSuperview];
Or:
for (UIView *v in self.view.subviews) {
if ([v isEqual:myView]) {
[myView removeFromSuperview];
}
}
Or:
[((NewsPadAppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController.view removeFromSuperview];
To remove the view controller you remove its view, like this:
[name_of_my_RootViewController.view removeFromSuperview];
Sounds like you should be presenting the UINavigationController modally in the first place. Set up a plain UIViewController called rootViewController and make that visible instead of the navigation controller, then call:
[rootViewController presentModalViewController:navigationController animated:YES];
And when you're done with it, hit a button on the navigation controller which calls:
[self dismissModalViewControllerAnimated:YES];
And you'll go back to the plain UIViewController where you can show the rest of your app.