Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7918255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:26:30+00:00 2026-06-03T15:26:30+00:00

As you probably know, all class methods of CCFileUtils in Cocos2D-iphone 1.x were rewritten

  • 0

As you probably know, all class methods of CCFileUtils in Cocos2D-iphone 1.x were rewritten as instance methods of the singleton [CCFileUtils sharedFileUtils] in Cocos2d 2.x, so instead of

[CCFileUtils fullPathFromRelativePath:... resolutionType:...]

we need to use

[[CCFileUtils sharedFileUtils] fullPathFromRelativePath:maskFileName resolutionType:&resolution]

I’ve written an extension for masking sprites (http://www.cocos2d-iphone.org/forum/topic/30494), which uses CCFileUtils heavily and now need to make it compatible with both cocos2d 1.x and 2.x

I know about CC_ENABLE_DEPRECATED flag which helps to translate those calls on the fly, but i’d like to have a clear solution. Something like a class method which will return me an id for use it like this:

Method:
+ (id) getCCFileUtils
{
id fileUtils = [CCFileUtils class];
if ([fileUtils instancesRespondToSelector:@selector(fullPathFromRelativePath:resolutionType:)])
{
    return [fileUtils sharedFileUtils];
}
else
{
    return fileUtils;
}
}
Usage:
id myFileUtils = [MyClass getCCFileUtils];

[myFileUtils fullPathFromRelativePath:maskFileName resolutionType:&resolution]

}

For sure, I get an error “No known instance method for selector ‘sharedFileUtils'” in Cocos 1.x, because there is no such selector. How should i rewrite it to get working?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:26:31+00:00Added an answer on June 3, 2026 at 3:26 pm

    Well, i did it myself after sleeping a bit 🙂
    Share the code:

    /**In Cocos2d v 2.0 CCFileUtils class methods were moved to instance methods.
     Here we set SSK_FILE_UTILS to class or instance depending on Cocos2D version.
     */
    #ifdef COCOS2D_VERSION
        #if COCOS2D_VERSION >= 0x00020000
            #define SSK_FILE_UTILS [CCFileUtils sharedFileUtils]
        #else 
            #define SSK_FILE_UTILS CCFileUtils
        #endif
    #else
        #define SSK_FILE_UTILS nil
    #endif
    

    Usage:

    [SSK_FILE_UTILS fullPathFromRelativePath:... resolutionType:...]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first of all i would like to say i know its probably an easy
Most of you probably know the following problem: You edit an HTML, view the
I think I probably know that the most common suggestion will be change the
Alright, so as you probably know, static inheritance is impossible in C#. I understand
Cited from http://xss-proxy.sourceforge.net/Advanced_XSS_Control.txt : As many here probably know, current XSS attacks typically come
This is one of those I probably should know this, but I don't questions.
This is something stupid I probably should know, but Googling fails me: When compiling
WCF gurus, you probably already know the answer I cannot find ... let's say
I know it probably sounds like very trivial question but I couldn't find any
I know this probably really simple but Im not sure what im doing wrong...

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.