Import cocos2d games to iOS
1. Introduce cocos2dx to your project in xcode. You need to import the cocos2d_libs static library. First, you need to download the cocos2d engine from the official website.
2. Copy the cocos2d engine to the project directory and add Files .. to the project.
3. Add dependent Libraries
4. Configure the project
1. Configure in Build Settings
Set Valid ubuntures
2. Set Build Options-> Enable Bitcode to NO.
3. Set Other Linker Flages as follows:
4. Set the Header Search Paths in the project, relative path, cocZ signature? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vczJkzsS8/kernel/nU2s671sM8YnIgLz4NCgk8aW1nIGFsdD0 =" here write picture description "src =" http://www.bkjia.com/uploads/allimg/160416/0433095155-5.png "title =" \ "/>
5. set Other C flages
-DNS_BLOCK_ASSERTIONS = 1
6,
7. Apple LLVC 7.0-PreProcessing
Debug:
USE_FILE32API
CC_TARGET_ OS _IPHONE
COCOS2D_DEBUG = 1
CC_ENABLE_CHIPMUNK_INTEGRATION = 1
Release
USE_FILE32API
CC_TARGET_ OS _IPHONE
CC_ENABLE_CHIPMUNK_INTEGRATION = 1
8. Apple LLVM 7.0 Warnings-All versions ages
9. Set the pch path
5. to load the cocos2d game file, modify the delegate name and the agent name in main.
// Main function content # import
# Import "AppController. h "int main (int argc, char * argv []) {@ autoreleasepool {return UIApplicationMain (argc, argv, nil, NSStringFromClass ([AppController class]);}
// Pch content # ifdef _ OBJC _ # import
# Import
# Endif # ifdef _ cplusplus # include "cocos2d. h" # endif
Running effect: