Sequence action with CallFunction of sprite in cocos2d html5

var actionMove = cc.MoveTo.create(0.5, cc.p(colorbg.getPosition().x - 395, colorbg.getPosition().y));
colorbg.runAction(cc.Sequence.create(cc.CallFunc.create(function(){this.touchFunction(false)}, this), 
                                actionMove,
                                cc.CallFunc.create(function(){ this.touchFunction(true)},
                                this)));

touchFunction:function(bool){
    	if( 'touches' in sys.capabilities ) {
		  this.setTouchEnabled(bool);
		  this.nextbackFlag = bool;
		}
		if( 'mouse' in sys.capabilities ) {
		  this.setMouseEnabled(bool);
		  this.nextbackFlag = bool;
		}

Fixing Undefined Symbols While Integrating Testflight in IOS

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.

Converting a CLLocation object to CLLocationCoordinate2D in Xcode

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

How to Initialize a CLLocation object with a Latitude and Longitude in Xcode

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];

How to Get the RootViewController from within a Scene in Cocos2d Xcode

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.