Problem in Cocos2d - iphone

I downloaded "cocos2s iphone-1.0.0-rc" and "cocos2d 1.0.0 beta template foe Xcode4"
and copy them to '/developer/Library/Xcode/Templates ' then open xcode and click on
new project ans see add 3more types of project (cocos2d,cocos2d-box2d,cocos2d-chipmunk)
and i create a project with cocos2d and doesn't add any code to it and run it but occur 6 errors,3 warnings in class 'CCTexture2D.m':
Font Manager undeclared ()
Assigning to 'CGSize'(aka struct
CGSize)from incompatible type id
method -sizeWithZfont not found
NSSTring may not respond to
'sizeWithZFont'
Incompatible types in assignment
Method 'drawInRectWithZfont' not found
i open Link binary With Libraries and can't find Cocos2d from list
and i add #import "cocos2d.h" in prefix.pch but doesn't work
Please help me to solve this problem

Have you installed cocos2d with the terminal, like this?
Run the 'install-templates.sh' script:
$ cd cocos2d-iphone
$ ./install-templates.sh -u -f

Related

Swift Package Manager (package successfully added, but Module not found)

I'm new in Swift. I want to create iOS app that can connect to PostgreSQL database. First I found library https://github.com/vapor/postgresql.git that should be added to my project via Swift Package Manager. Using tutorial I added required library to my project successfully (File -> Swift Packages -> Add Package Dependency):
list of added packages from SPM
But when I try to import this module into my view controller, Xcode shows error that module is not found:
not found
I tried several times to rebuild my project, created new project just for testing this issue. Also I found information about build phases and added this lib as a dependency:
build phases
But I still get error: "No such module PostgreSQL".
Can anyone help me?
I found solution by myself. I compiled C static library "libpq" (can be found in PostgreSQL sources) and added it to my swift project. Included this library by adding special bridging header file. Finally I got what I wanted.
P.S. If someone what to repeat, he or she should know: static C library must be compiled for iOS device architecture (and also in iOS simulator architecture which differs from iOS device arch.).

How to create a React-Native framework using Swift

I have a react native component written in Swift, and I want to extract it as a framework so other project/people can use it easily.
First I created a new iOS project Foo, added a framework target,
then added source files. Finally, I built it.
It failed because:
Bar.swift:[lineNumber]: Use of unresolved identifier 'RCTConvert'
RNBarManager.swift:[lineNUmber]: Use of undeclared type 'RCTViewManager'
Attempt 1:
I ran react-native link, but nothing changed.
Attempt 2:
Drag React.xcodeproj to Foo project and add libReact.a to Link
Binary With Libraries.
Add $(SRCROOT)/../node_modules/react-native/React to Header Search Paths.
But it doesn't work. The error still remains.
Attempt 3:
I was thinking maybe Swift doesn't recognize these files.
So I added Foo-Bridging-Headers.h like I did in a React-Native App, which contains the following code:
#import "React/RCTBridge.h"
#import "React/RCTViewManager.h"
#import "React/RCTUIManager.h"
#import "React/UIView+React.h"
#import "React/RCTBridgeModule.h"
I also added Foo-Bridging-Headers.h to Build Settings->Swift Compiler - General->Object-C Bridging Header,
Still I got an error.
using bridging headers with framework targets is unsupported
It seems bridging headers are not allowed here.
Attempt 4:
I tried to add these imports to Foo.h,
but got an error again.
Foo.h:21:9: Include of non-modular header inside framework module 'Foo'
What should I do to compile successfully?
This seems like an issue with the cocoa pods required for linking React to your project.
Try running pod install in your project directory using terminal and then try to build.
The linking happens in the hosting app, and not in the framework you've made. That will just need the headers.

Can't build command line project with SQLite.swift

I'm trying to build a command-line tool which uses sqlite. I have downloaded Stephen Celis' swift wrapper, SQLite.swift, and built a working OS X app. However, I am not able to build my command-line tool. I believe that I correctly followed the instructions to do so in the SQLite.swift Documentation for frameworkless targets, but apparently I am missing something. I get an error in Helper.swift # import CSQLite -> No such module 'CSQLite'.
I am linking against libsqlite3.dylib (also tried libsqlite3.tbd)
I added the SQLite.swift source to my project
I added #import sqlite3.h & #import "SQLite-Bridging.h" to my bridging header file. Perhaps of note, when I right-click on sqlite3.h or SQLite-Bridging.h, xCode does not know where/what they are.
I'm happy to send my test project (about 80KB, compressed) to anyone who can and is willing to help. There is probably a very simple solution, I just do not see what it is.
thx for any help,
-Craig
I've faced the same problem.
There were lots of compiler errors like "Connection.swift:26:8: Could not build Objective-C module 'CSQLite'"
The error has roots to the "lctx.h:13:25: Use of undeclared identifier 'SYS_getlcid'"
It worth mentioning that I have two Xcodes installed - v 6.2 at /Applications and v 7.3 at ~/Applications. My project is iOS app on Swift with SQLite pod and I open it with the Xcode 7.3.
The SQLite pod has a file at project_folder/Pods/SQLite.swift/CocoaPods/iphonesimulator/module.modulemap.
The file had the content
module CSQLite [system] {
header "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sqlite3.h"
export *
}
To fix compiler errors I changed the content of module.modulemap to
module CSQLite [system] {
header "/Users/my_user_name/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/sqlite3.h"
export *
}
The change is that I pointed search of sqlite3.h into my ~/Applications folder where Xcode 7.3 is located.
This made my project compiling.

Early grey environment setup

I'm trying to get Earlgrey setup on my computer by following the steps for Cocoapod installation as described here
After performing all the steps I keep on getting compilation error during build
EarlGrey.swift:17:27: Use of undeclared type 'EarlGreyImpl'
There are 13 such compilation errors all related to unresolved identifier.
I re-tried the steps multiple times with same results. My folder structure matches with what is shown in the instructions.
Any suggestions where should i look further to get this resolved.
For reference i'm using this swift project as base for writing test cases.
So the issue was related to BridgingHeader.h file setting in
test target -> build Setting -> Swift compiler -Code generation -> Objective-C bridging Header
I copied the file from demo project, but did not specify it in the above setting. Once specified there, the compilation errors was gone.
Try importing EarlGrey using #import <EarlGrey/EarlGrey.h> instead of #import EarlGrey;

Foundation framework. No NSString.h file

I'm getting a few errors just after I updated my working copy via SVN.
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCharacterSet.h:8:0 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCharacterSet.h:8:32: error: Foundation/NSString.h: No such file or directory
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCharacterSet.h:45:0 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSCharacterSet.h:45: error: expected ')' before 'unichar'
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSPathUtilities.h:10:0 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSPathUtilities.h:10: error: cannot find interface declaration for 'NSString'
All that errors tell that compiler is unable to find NSString.h file in Foundation framework and I have opened the Foundation framework in Xcode/Frameworks/Foundation.framework/Headers and noticed that there is no NSString header file there. Could anyone tell me what happened? I tried to delete the framework and add it again but it failed to. Still I don't have NSString header file.
try installing XCode again. Older SDK versions are no longer supported. Choose SDK 4.2 instead and compile it again. (I have copied the SDK 4.0 for backward compatibility but it is not shown in targets and project settings)
I had this problem in a project started in XCode 3 and now compiled in XCode 4, where the line
-#include <Foundation/NSString.h>
was flagged as no such file. I fixed it by re-adding the framework - although it was already appearing in my project (from when I had added it in XCode 3) using this approach:
How to "add existing frameworks" in Xcode 4?
I noticed the list seen by using this method did not include the Foundation framework.