Just replacing the contents of the folder may not be enough, at least it's not guaranteed to work all the time.
Consider the case where a new source code file was added. It won't be added automatically to your project's target. This would cause an error.
Consider a class that was renamed from CCSomeClass to CCOtherClass and thus the corresponding source code files changed their names too. Your project's target would continue to use CCSomeClass. At best, you'll be using old code. Slightly worse, this may cause unforseeable runtime issues. At worst the code won't compile.
Consider the case where new cocos2d resource files are added, renamed or removed. Again, this can cause issues because your project isn't modified if you just replace the files.
To upgrade cocos2d in an existing project it is recommended to install the new Xcode templates, create a new project from that template, then add your source code and resource files to the new project.
If you get sick and tired of this process (I know I did after the second time) consider using Kobold2D which allows your projects to be upgraded with the click of the mouse by using its Project Upgrader tool.