Cocos2d x Archives

The common undefined symbol error appearing while integrating test flight will be something like the following :

Undefined symbols for architecture armv7s:

“_deflateInit_”, referenced from:

_compress_data in libTestFlight.a(tf_compression.o)

“_deflateEnd”, referenced from:

_compress_data in libTestFlight.a(tf_compression.o)

“_deflate”, referenced from:

_compress_data in libTestFlight.a(tf_compression.o)

ld: symbol(s) not found for architecture armv7s

clang: error: linker command failed with exit code 1 (use -v to see invocation)

 

The fix for this issue is simple.

Goto the build phases of the target for which the issue is appearing. In the link binary with libraries section, use the ‘+’ button at the bottom to add a new library. In the dialog box which appears, search for libz.dylib . You will see the library in the list. Select that and press the ‘Add’ button.

Now perform a build clean for the project and you are done.

Build the app and the issue will be fixed.

Incoming search terms:

  • _compress_data in libtestflight a(tf_compression o)
  • cclocation cocos2d-x
  • cocos2dx ios6 fadeout problem
  • how to make dialog box using cocos2dx
  • _deflate referenced from testflight

We can convert a CLLocation object to a CLLocationCoordinate2D object using the coordinate property of the CLLocation object. This can be done as follows :

 

Consider a CLLocation object name myLocation. Now we can get the equivalent CLLocationCoordinate2D of myLocation as,

 

CLLocationCoordinate2D myCoordinate = myLocation.coordinate;

 

We can obtain the latitude and longitude of a CLLocationCoordinate2D object using its latitude and longitude properties.

 

i.e.,

double myLatitude = myCoordinate.latitude; // this will give the latitude value of the coordinate

double myLongitude = myCoordinate.longitude;// this will give the longitude value of the coordinate

Incoming search terms:

  • cllocation to cllocationcoordinate2d
  • CLLocationCoordinate2D to cllocation
  • ios CLLocationCoordinate2D与CLLocation
  • cllocation CLLocationCoordinate2D
  • xcode cllocationcoordinate2d latitude
  • xcode cllocation from coordinates
  • ios develop CLLocation CLLocationCoordinate2D
  • how to convert cllocationcoordinate2d to cllocation
  • how to convert cllocation to double in ios
  • from cllocation to cllocationcoordinate2d

It is possible to initialize a CLLocation object with a latitude and longitude in Xcode. Consider two float values corresponding to the latitude and longitude value you want to use, as follows :

 

double your_latitiude_value = 8.391916;

double your_longitude_value = 77.094315;

 

We can initialize a CLLocation object using these latitude and longitude values as follows :

 

CLLocation *myLocation = [[CLLocation alloc] initWithLatitude:your_latitiude_value longitude:your_longitude_value];

Incoming search terms:

  • xcode howto enable cllocation
  • cllocationmanager iphone xcode
  • how to create cllocation object
  • ios CoreLocation make CLLocation from latitude longitude
  • xcode cllocation with latitude longitude
  • xcode howto cllocation google by address
  • xcode latitude longitude from address google

It is possible to get the rootviewcontroller of the project from within a class or scene in cocos2d using Xcode. This can be done using the nextResponder method of the OpenGLview of cocos2d director. It can be implemented as follows :

 

 

 

UIViewController *rootViewController = (UIViewController *)[[[CCDirector sharedDirector] openGLView] nextResponder];

 

In this, the rootViewController object will contain the original root view controller of the project.

Incoming search terms:

  • cocos2d 2 0 rootviewcontroller
  • cocos2d-x get rootviewcontroller
  • cocos2d-x view controller
  • cocos2d-x viewcontroller scene
  • cocos2dx get rootviewcontroller
  • xcode root view controller news

How to include and use new fonts in iPhone SDK?

  1. Add the font files to your resource files
  2. Edit your Info.plist: Add a new entry with the key Fonts provided by application.
  3. For each of your files, add the file name to this array

In your application you can the use [UIFont fontWithName:@"YourFontName" size:14.f].

Note: this is available in iOS 3.2 and later.

You can use the following lines of code to make the view looks like a pop up with fade-In effect. For that, first create an UIVIew and assign its alpha value to zero. Here, my UIView is named as : ‘MyView’ :

// Function for FadeIn/PopUp effect for the UIView //

-(void)effectFunction_FadeIn{
MyView.transform = CGAffineTransformMakeScale(1.3, 1.3);
MyView.alpha = 0;
[UIView animateWithDuration:.35 animations:^{
MyView.alpha = 1;
MyView.transform = CGAffineTransformMakeScale(1, 1);
}];
}

 

Now, you can use the below code to make it disappear like a popout/ with Fade-Out effect:

-(void)effectFunction_FadeOut{
MyView.transform = CGAffineTransformMakeScale(1.3, 1.3);
MyView.alpha = 1;
[UIView animateWithDuration:.35 animations:^{
MyView.alpha = 0;
MyView.transform = CGAffineTransformMakeScale(1, 1);
}];
}

 

Incoming search terms:

  • how to add uiview animation in cocos2d

To fix the orientation issue in IOS6 while using Cocos2d, perform the following :

 

Inside AppDelegate.m file

Replace the following line of code

[window addSubview: viewController.view];

With the following lines of code

if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)

{

// Note : addSubView doesn’t work on IOS6

[window addSubview: viewController.view];

}

else

{

// For IOS6, use this method

[window setRootViewController:viewController];

}

Now inside RootViewController.m file

// For IOS6, use supportedInterfaceOrientations & shouldAutorotate instead of shouldAutorotateToInterfaceOrientation

- (NSUInteger) supportedInterfaceOrientations{

return UIInterfaceOrientationMaskLandscape;

}

- (BOOL) shouldAutorotate {

return YES;

}

That is it. The orientation issue will be fixed now.

Note : If your application supports for IOS versions less than 6.0, then you can keep the shouldAutorotateToInterfaceOrientation method.

Incoming search terms:

  • cocos2d ios 6 rotation
  • cocos2d uidevice ios6
  • cocos2d-x orientation ios6
  • ios6 shouldAutoRotate
  • uimodaltransitionstylepartialcurl height

Getting Device IOS Version in Xcode

To get the current running device IOS version  using Xcode, use the following code :

[[UIDevice currentDevice].systemVersion floatValue]

The resultant value will be a floating value.

For example, for IOS6, the above code will return the value 6.0

 

Schogini in association with Giann Pte Ltd is organising a 4 hour incredible iPhone App Mastery Workshop in Singapore. This is one of it’s kind Mobile Programming Workshop in Singapore that can take you to the next level.

You can learn How to build an iPhone game in just 4 Hours. Moreover you get a fully working kit of a game that is live in Google Play. Schogini has created 450+ live apps, from Chess to Khet! You can now learn it from the most prolific app developer. You will get to directly experience our team’s exceptional capability to groom you into a world class professional in a short span. Our intern Unmesh Gangadharan was trained by us on mobile programming during his internship, he went on to receive the best app award and appreciation from UK Prime Minister David Cameroon.

Do not miss this rare opportunity to upgrade your programming skills to reach to the next level: The iPhone and iPad Application Development! Register Now! http://ub.schogini.com/iPhone-app-development-training-learn/

Simply put, you would want to create any controls or arrays in viewDidLoad, where as in viewDidAppear is where you would want to refresh those controls or arrays.

viewDidLoad is called once when the controller is created and viewDidAppear is called each time the view, well, DID appear. So say you have a modal view that you present, when that view is dismissed, viewDidAppear will be called, and viewDidLoad will not be called.

Page 1 of 3123