{"id":7146,"date":"2014-05-26T00:44:41","date_gmt":"2014-05-26T00:44:41","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/26\/objective-ccocos2d-iphonecocos2dcctexturecacherelated-issues-collection-of-common-programming-errors\/"},"modified":"2014-05-26T00:44:41","modified_gmt":"2014-05-26T00:44:41","slug":"objective-ccocos2d-iphonecocos2dcctexturecacherelated-issues-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/26\/objective-ccocos2d-iphonecocos2dcctexturecacherelated-issues-collection-of-common-programming-errors\/","title":{"rendered":"objective-c,cocos2d-iphone,cocos2d,cctexturecacheRelated issues-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/93428d0acc695aceb5887623db6f449f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nuser1765037<br \/>\nobjective-c xcode sup<br \/>\nI am a beginner in native development.I made a project using xcode in objective C.It builded successfully.But when I run the project ,an error came like &#8216;unrecognized selector sent to instance&#8217;.Why this is happening ?can anyone help me to solve this?I am attaching the error that I am getting with this..And I am posting the code with this&#8230;.ConnectionController.m#import &#8220;ConnectionController.h&#8221; #import &#8220;SUPApplication.h&#8221; #import &#8220;Flight_DetailsFlightDB.h&#8221; #import &#8220;CallbackHandler.h&#8221;@interface C<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c521c11562c3540db79eca1cd632bd5e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBrock Woolf<br \/>\nobjective-c cocoa cocoa-touch nsstring<br \/>\nI have an NSString like so:@&#8221;200hello&#8221;or @&#8221;0 something&#8221;What I would like to be able to do is take the first occuring number in the NSString and convert it into an int. So that @&#8221;200hello&#8221; would become int = 200.and @&#8221;0 something&#8221; would become int = 0.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/530d60c4e39f05f49896c2c37078411a?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBartosz Ciechanowski<br \/>\nobjective-c lambda objective-c-blocks continuations structured-programming<br \/>\nWhen using methods which return blocks they can be very convenient. However, when you have to string a few of them together it gets messy really quicklyfor instance, you have to call 4 URLs in succession:[remoteAPIWithURL:url1 success:^(int status){[remoteAPIWithURL:url2 success:^(int status){[remoteAPIWithURL:url3 success:^(int status){[remoteAPIWithURL:url2 success:^(int status){\/\/succes!!!}];}];}]; }];So for every iteration I go one level deeper, and I don&#8217;t even handle errors in the nested<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8fff58d9d1012e7c2b0e1a2589c2ca7e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDavoda<br \/>\nios objective-c facebook-graph-api facebook-ios-sdk<br \/>\nI have a token but keep getting this error: &#8220;An active access token must be used to query information about the current user.&#8221; Any help is appreciated \ud83d\ude42 NSLog(@&#8221;TOKEN : %@&#8221;,[[FBSession activeSession] accessToken]);NSString *picture = [NSString stringWithFormat:@&#8221;http:\/\/www.prowebdev.org\/WooF\/API\/OpenGraph.php&#8221;];NSString *image = [NSString stringWithFormat:@&#8221;http:\/\/www.prowebdev.org\/WooF\/API\/upload\/356.jpg&#8221;];NSString *imageBool = [NSString stringWithFormat:@&#8221;true&#8221;];NSMutableDictionary *myDiction<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/4e497767d0a1523c9afbbe2722a73523?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRakhe Kara<br \/>\nios iphone objective-c cocoa-touch<br \/>\nActually this crash is not reproducing every time, even not frequently but we got this crash in our production app. I am not sure where is the problem. It is telling crash is happening in thread 4 in Environments class line number 38.Code:NSBundle* bundle = [NSBundle mainBundle];NSString* envsPListPath = [bundle pathForResource:@&#8221;Environment&#8221; ofType:@&#8221;plist&#8221;];Line 38: NSDictionary *environments = [[NSDictionary alloc] initWithContentsOfFile:envsPListPath];But according to exception type:00000020<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/cc54370be995ce0d68289d82ec143fe1?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nMusterknabe<br \/>\nios objective-c<br \/>\nI have the following problem. I have a Model, called User. When the user now logins with Facebook, my app checks if the user exists already in the database. To not freeze the UI (since I&#8217;m coming from Android) I thought to use NSURLConnection sendAsynchronousRequest. What worked at first was the following:My User Model had a method to do the whole task of the AsynchronousRequest and then when finished would set a variable to loading. Then other classes, could simply check with while ( !user.loa<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6af6c4c44575775210dca60bcc8eec47?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAndy<br \/>\nios objective-c unity3d<br \/>\nI have a very tiny Objective-C library built for iOS and I want to export it to Unity. I understand the basic process of writing a csharp wrapper that marshals all the invocations to native library, but I completely have no idea where to start. Could anyone please explain step-by-step how to create a unity package with my library so I could also distribute it to other developers.Unity3d documentation is pretty brief and does not explain anything.Thanks.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3786e4b772ba9c3fcebdb7c53684aa52?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJosh Bradley<br \/>\nobjective-c sockets bsd-sockets<br \/>\nOk, I have a problem with building a socket using Objective-C. If you&#8217;ll take a look at my code below, through help with example code and other sources, I was able to build a complete socket I believe. The problem is that when I compile it, it builds fine (no syntax problems), but there are no sockets being created. As you&#8217;ll notice I&#8217;ve commented out a lot of things in Server2.m and have isolated the problem to the very beginning when I create the struct for the listeningSocket. By the way, if<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c66f5ead165235158b86a421c1adb00d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nzioolek<br \/>\nobjective-c cocoa nsimage pgm<br \/>\nHi everyone! It is my first post here.I am quite new in objective-c so maybe my question is not so hard but It is a problem for me. I&#8217;ve searched the web and didn&#8217;t find any useful hints for me&#8230; I am writing a program in Objective-c in Xcode. I need to read and display a pgm file (P5 with two bytes per pixel). To do that i&#8217;m trying to subclass NSImageRep but I don&#8217;t know how to create a proper bitmap for this file and how to draw it. Below is my code so far:header:@interface CTPWTPGMImageRep :<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/49756adee7cc8a8a3b80c85639ff3d82?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTodd Ditchendorf<br \/>\nobjective-c xcode frameworks compiler-errors parsekit<br \/>\nI am trying to add the Parsekit framework to my OSX Xcode project. I&#8217;ve never added a 3rd party framework before and I can&#8217;t get it to work right.I dragged the included Xcode project into my &#8216;Groups &amp; Files&#8217; pane and chose to Add it to my project. I then dragged Parsekit.framework underneath the Link Binary With Libraries heading. Then I double-clicked my target app and added Parsekit as a Direct Dependency. I also added libicucore.dylib as a Linked Library (as it says to do this on their si<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3a506e3d5853364fcfd5b3d473daf7c4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nWaneck<br \/>\niphone ios opengl-es cocos2d-iphone antialiasing<br \/>\nI am new to opengl programming, but I am doing something very basic, and the difference of quality between a custom opengl code and cocos2d is huge!I am trying just to load an image and continuously rotate it every frame. With my code, I get a lot of flickering, sharp edges, while cocos2d has it all nice and smooth. I&#8217;ve set up 4x Multi-Sampling Anti-Aliasing using apple&#8217;s recommended code for iOs 4 on my code, and still it looks very bad in comparison to cocos2d without any MSAA.You can see the<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/81d2c0d1e169fccb63893706ef70db19?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nrmaddy<br \/>\nxcode opengl-es cocos2d-iphone<br \/>\nI&#8217;ve created an iPhone game which utilizes some code from an old version of the Cocos2D iPhone game development framework and I&#8217;ve got a wee bit of a problem running it on iOS 7.The version of Cocos2d from which the code was used was probably 0.98.The actual class is called QuadParticleSystem (in newer versions it&#8217;s been deprecated by CCParticleSystemQuad).The actual issue is that the game runs fine on iOS 6 and below. It even runs fine on iOS 7 if the deployment target is set to iOS 6.0 and SDK<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/dae907d26dd200d065227e2a020bc999?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nStephane Delcroix<br \/>\ncocos2d-iphone monotouch xamarin.ios<br \/>\nI have an issue when I subclass a type which bind an obj-C type. In some cases, it fails at construction time.I can reproduce this right now with the cocos2d bindings and CCSprite. Here&#8217;s my subclasspublic class MySprite : CCSprite {public MySprite (string filename) : base (filename){} }When I instantiate it, it fails:Stacktrace:at (wrapper managed-to-native) MonoTouch.ObjCRuntime.Messaging.void_objc_msgSendSuper_IntPtr (intptr,intptr,intptr) &lt;IL 0x00025, 0xffffffff&gt;at MonoTouch.Cocos2D.CC<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/60f488d7baa5fdcb7dd19dadf3686e35?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ndropcode<br \/>\nc++ cocos2d-iphone box2d box2d-iphone<br \/>\nI don&#8217;t know much C++ and I am trying to implement a solution I found &#8211; (Getting the world&#8217;s contactListener in Box2D) using Cocos2d-box2d. Here is the Contact Listener.SubcContactListener.h:#import &lt;Foundation\/Foundation.h&gt; #import &#8220;cocos2d.h&#8221; #import &#8220;Box2D.h&#8221; #import &lt;vector&gt; typedef std::pair&lt;b2Fixture*, b2Fixture*&gt; fixturePair; typedef std::vector&lt;fixturePair&gt; thingsThatTouched;extern thingsThatTouched g_touchingFixtures;class SubcContactListener : public b2ContactLi<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f67f5c1f611bd37a092285876ba5f7fb?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJames Webster<br \/>\ncocos2d-iphone callback game-physics chipmunk<br \/>\nI\u2019m using Cocos2d v3 and want to change a body from dynamic to static after colliding with another body. At the moment I\u2019ve got:-(void)ccPhysicsCollisionPostSolve:(CCPhysicsCollisionPair *)pair static:(CCNode *)nodeA wildcard:(CCNode *)nodeB {_player.physicsBody.type = CCPhysicsBodyTypeStatic; }or-(BOOL)ccPhysicsCollisionPreSolve:(CCPhysicsCollisionPair *)pair static:(CCNode *)nodeA wildcard:(CCNode *)nodeB {_player.physicsBody.type = CCPhysicsBodyTypeStatic;return YES; }but neither works. I get<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b3e4dd7c5432a1c61160d1b9b87399ff?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGuru<br \/>\nobjective-c cocos2d-iphone core-audio simpleaudioengine<br \/>\nI read about preloading sounds in SimpleAudioEngine through [[SimpleAudioEngine sharedEngine] preloadEffect:@&#8221;bell.wav&#8221;];But, with this there are memory leaks which I read on couple of sites. On some websites it was used like this: &#8211;(void)loadSoundFilesInBackground {NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];[[SimpleAudioEngine sharedEngine] preloadEffect:@&#8221;bell.wav&#8221;];[pool release]; }What is the best way to load sound files in background through SimpleAudioEngine ? What is the<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/808ba667d45cea35164ec83de49b0de8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJust Kidding<br \/>\ncocos2d-iphone<br \/>\ncocos2d-iphone 1.0.1.I have noticed this with other cocos2d-iphone games installed in my device, like Kingdom Rush.Basically, most of the times, the audio is fine (almost always). But suddenly, at an unexpected moment, the background music stops playing and only the sound effects work. Sometimes, killing the application will not be enough to fix it.With my cocos2d-iphone game this happens as well, with no hint in the console. I use SimpleAudioEngine to play background music and sound effects.Kil<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8d63368d48ce7cd63f3be1eeced67d37?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTiddly<br \/>\niphone ios cocos2d-iphone cocos2d<br \/>\nI&#8217;m using cocos2d for iOS. Not sure if I&#8217;m doing something wrong here or if CCParallaxNode does something strange that I just don&#8217;t understand.I&#8217;m trying to create a few layers of parallax scrolling in the background of my game, at the moment I just have one layer added to the parallax node till I can figure out what&#8217;s going wrong. When the game loads the layer it&#8217;s always offset down and left by about 30% of the image size. I&#8217;ve uploaded an image demonstrating the difference in position here ht<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/32cdc777a19a6f2b2129decd30061cd1?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nkender<br \/>\niphone cocoa-touch memory-management cocos2d-iphone<br \/>\nI have an iPhone application in Cocos2d that sometimes crashes on actual device, due to memory problems. What I have so far found out is that the scenes, when switched, aren&#8217;t fully released &#8211; the [retainCount] for them is somewhat about 4-10 \ud83d\ude42 The dealloc method never gets called, and then I assume, when I switch the scenes a few times, the memory issue shows up. I&#8217;m wondering &#8211; where should I relese the scene? Since it has number of children, I suppose I should be doing a cleanup-removal of t<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/996952de195a8bc83b2421e49a754e7d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nLearnCocos2D<br \/>\ncocos2d-iphone uialertview<br \/>\nI am trying to lay buttons on top of a background image for a UIAlertView in Cocos2d. Its not working with the code below. any suggestions?UIAlertView *Win=[[UIAlertView alloc] initWithTitle:@&#8221;You Win&#8221; message:nil delegate:self cancelButtonTitle:@&#8221;Next&#8221; otherButtonTitles:@&#8221;Replay&#8221;,@&#8221;Quit&#8221;, nil];UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(-50, -30, 400, 300)];NSString *path = [[NSString alloc] initWithString:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathCom<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/943fe748f9902ced31e983c13f356e64?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRicardo Cerqueira<br \/>\nios xcode crash cocos2d adhoc<br \/>\nmy app runs fine on development mode, but for some reason on ad hoc i get a crash right after loading screen.I really can&#8217;t understand what could be wrong, any tips on how to test it better?Apple rejected it with this message:We found that your app failed to launch on an iPhone 5 and iPad 3rd gen running iOS 6.1.3, on both Wi-Fi and cellular networks.We encountered the issue when selecting the application on the Home screen &#8211; the app displayed a launch image then quit unexpectedly. This may be b<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f4380894d84edf7f07942719dc105a9f?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nClever<br \/>\nios objective-c cocos2d<br \/>\nHow would you go about protecting a shared resources in cocos2d so that only one class or method is allowed to access or change it at one time? My initial though was to setup a class that handles Lock \/ Unlock coordination as follows: &#8211; (BOOL)requestLock {if (self.lockAvailable == YES) {self.lockAvailable = NO;return YES;}return NO; }- (void)returnLock:(CGFloat)time {self.timer = 0;self.timeToUnlock = time; }- (void)update:(CGFloat)dt {self.timer += dt;if (self.timer &gt; self.timeToUnlock) {sel<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/d53f5657b8b1959ab3b79dd78bf1aa38?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nohthepain<br \/>\nandroid c++ eclipse cocos2d<br \/>\nI am new to Eclipse\/Android. I have a cocos2d-x project and have added Box2D based on the responses to http:\/\/www.cocos2d-x.org\/boards\/6\/topics\/20827.When I do Project\/Clean\/(Clean all projects) I getClean: box2d_static [armeabi]rm -rf (TARGET_OBJS)\/bin\/sh: -c: line 0: syntax error near unexpected token `(&#8216;I haven&#8217;t been able to find the rm -rf (TARGET_OBJS) line in any shell scripts, so I have no idea where this error is coming from.My hunch is that I may be mixing up a copy of the Box2D source<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8d63368d48ce7cd63f3be1eeced67d37?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTiddly<br \/>\niphone ios cocos2d-iphone cocos2d<br \/>\nI&#8217;m using cocos2d for iOS. Not sure if I&#8217;m doing something wrong here or if CCParallaxNode does something strange that I just don&#8217;t understand.I&#8217;m trying to create a few layers of parallax scrolling in the background of my game, at the moment I just have one layer added to the parallax node till I can figure out what&#8217;s going wrong. When the game loads the layer it&#8217;s always offset down and left by about 30% of the image size. I&#8217;ve uploaded an image demonstrating the difference in position here ht<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/45a2ee9b3b785e852d9223796ab1c153?s=32&amp;d=identicon&amp;r=PG&amp;f=1\" \/><br \/>\nuser2225302<br \/>\nxcode cocos2d malloc<br \/>\nI&#8217;ve got a big project on cocos2d with ARC enabled. Some days ago I began to get theese strange errors:outfighter(16344,0&#215;601000) malloc: * error for object 0x1c8eaa00: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debugoutfighter(16359,0x3afe8b78) malloc: * error for object 0x1c5da4e4: incorrect checksum for freed object &#8211; object was probably modified after being freed. * set a breakpoint in malloc_error_break to debugoutfighter(16374,0&#215;705000) malloc: * erro<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b7ef12ab280e9228294134b9117fde51?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPaul Renton<br \/>\nobjective-c data-structures cocos2d<br \/>\nSome Context: In my destructible terrain library for Cocos2D, one of the features is collapsable terrain. In order to collapse efficiently, I store the columns whose pixels have been altered in a NSMutableSet which contains NSNumbers which contain integers. I am using this data structure because I don&#8217;t want to iterate over duplicate columns.My first instinct for how to loop through the NSMutableSet was to use a &#8216;for in&#8217; loop.for (NSNumber * col in [alteredColumns allObjects]) { \/\/ Works \/\/ for<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/960d77f6f10890a838c49457f9b78fe1?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\njason white<br \/>\nios cocos2d<br \/>\nI have several custom obects inside the coco2d environment that needed to be retained. so I set @property(nonatomic, assign) int score;@property(nonatomic, assign) Object *obj1;inside my CCLayer scene, I synthesize score and obj1, during the init function I set the value for score, and obj1, however later on , I find score and obj1 have no value or not assigned score=0; and obj1 = 0x0; what&#8217;s going on? can things be retained under coco2d environment?<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/9e331d4af820e0825db8ebea276a3836?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nredux<br \/>\ncocos2d<br \/>\nI can&#8217;t get my head around what&#8217;s going on here and I know I&#8217;m being stupid, but here&#8217;s whats going on:I have two images, one is 1024&#215;768, one is 2048&#215;1536. They are &#8220;background&#8221; textures. I&#8217;m trying to switch from one texture to the other:CCSprite *bg = [CCSprite spriteWithFile:@&#8221;one.jpg&#8221;]; bg.scale = 0.5; [self addChild:bg]; &#8230; CCTexture2D* tex = [[CCTextureCache sharedTextureCache] addImage:two.jpg]; [bg setTexture: tex];OK this is totally normal, the 2nd image fits perfectly into the same<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/adb6d5c350be2a297190ef589a873e4e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nZennichimaro<br \/>\nandroid ios cocos2d cocos2d-x<br \/>\nI have 2 MyGameScreen objects that extends cocos2d::CCLayer. I am capturing the ccTouchesMove of the first screen so that I can create the moving effect exactly like sliding between pages of iOS application screen.My class is like so:class MyGameScreen: public cocos2d::CCLayer {cocos2d::CCLayer* m_pNextScreen; }bool MyGameScreen::init() {m_pNextScreen = MyOtherScreen::create(); }void MyGameScreen::ccTouchesMoved(CCSet *touches, CCEvent *event){\/\/ it crashes here&#8230; on the setPosition&#8230; m_pNextS<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/2f90e858672c079741471f72cba5480c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBen<br \/>\ncocos2d cocos2d-x<br \/>\nIn the cocos2d-x HelloWorld project, I am trying to add another layer to the scene and keep a reference to this layer in a data member. Since the function HelloWorld::scene() is static, I cannot add the layer within this function (because I cannot set the data member for the layer).So I tried getting the scene in the init() function as follows, however this leads to scene = 0x00000000.What am I doing wrong?bool HelloWorld::init() {bool bRet = false;do {CC_BREAK_IF(! CCLayer::init());CCScene* sce<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/fb1b5f6466b194a2e66a8bc100d5b9cc?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\niSeeker<br \/>\nios cocos2d-iphone didreceivememorywarning cctexturecache<br \/>\nTo find a solution I have gone thru this similar link: TextureCache Error from Cocos2d when integrated into UIKit App but seems like it is dealing with this error in a different context..Question: I have a UIKit project integrated with Cocos2d. When build, succeeds and runs but, at times crashes after receiving a memory warning with this error:Assertion failure in -[CCTextureCache init], \/Users\/MyName\/Documents\/CSProject\/CSProject\/libs\/cocos2d\/CCTextureCache.m:90Terminating app due to uncaught<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/b3e4dd7c5432a1c61160d1b9b87399ff?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nGuru<br \/>\nobjective-c cocos2d-iphone cocos2d cctexturecache<br \/>\nI want to change a sprite texture with another texture from a sprite sheet\/\/normal sprite character = [CCSprite spriteWithSpriteFrameName:@&#8221;char1.png&#8221;];\/\/change texture [character setTexture:[[CCTextureCache sharedTextureCache] addImage:[CCSprite spriteWithSpriteFrameName:@&#8221;char2.png&#8221;]]];but this gives me an error.I have tried without spriteWithSpriteFrameName and it gives me a blank texture.\/\/error Terminating app due to uncaught exception &#8216;NSInvalidArgumentException&#8217;, reason: &#8216;-[CCSprite last<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n<p>I discovery a place to host code\u3001demo\u3001 blog and websites.<br \/>\nSite access is fast but not money<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.m5zn.com\/newuploads\/2014\/01\/30\/jpg\/e7da807964b1fff.jpg\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>user1765037 objective-c xcode sup I am a beginner in native development.I made a project using xcode in objective C.It builded successfully.But when I run the project ,an error came like &#8216;unrecognized selector sent to instance&#8217;.Why this is happening ?can anyone help me to solve this?I am attaching the error that I am getting with this..And [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7146","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7146","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7146"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7146\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7146"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7146"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7146"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}