iPhone应用程序开发-mysql->;php->;苹果手机
我的数据库中有下表:iPhone应用程序开发-mysql->;php->;苹果手机,php,iphone,mysql,xcode,Php,Iphone,Mysql,Xcode,我的数据库中有下表: Questions int:questionId(PK) varchar:questionTitle int:questionNumber int:sectionId(FK) 我在objective c中构建了几乎相同的结构化类 #import <Foundation/Foundation.h> @interface Question : NSObject { NSInteger qId; NSString* qTitle; NSIn
Questions
int:questionId(PK)
varchar:questionTitle
int:questionNumber
int:sectionId(FK)
我在objective c中构建了几乎相同的结构化类
#import <Foundation/Foundation.h>
@interface Question : NSObject {
NSInteger qId;
NSString* qTitle;
NSInteger qNumber;
}
@property (nonatomic) NSInteger qId;
@property (nonatomic, retain) NSString* qTitle;
@property (nonatomic) NSInteger qNumber;
@end
#import "Question.h"
@implementation Question
@synthesize qId, qTitle, qNumber;
@end
#导入
@接口问题:NSObject{
NSInteger-qId;
NSString*qTitle;
NSInteger-qNumber;
}
@属性(非原子)NSInteger qId;
@属性(非原子,保留)NSString*qTitle;
@属性(非原子)NSInteger qNumber;
@结束
#输入“问题h”
@实施问题
@合成qId、qTitle、qNumber;
@结束
我的问题是,是否有必要绘制结构图?iphone php通信是否存在兼容框架
e、 g.让php回显一个对象数组并为问题对象分配元素您需要构建一个小的“服务”,用json编码您的项目并通过http返回它们,以下是相关文档: 如上所述,您希望在项目中结合使用SBJSON[1]库和NSURLConnection/NSURLRequest或ASIHTTP[2]库。如果您不熟悉Cocoa/Obj-C中的http访问方法,那么ASIHTTP可能会更容易 这里有一个很好的例子: [1]
[2] 我不知道它是否是您想要的,但我将我的PHP值放入一个关联数组,将其编码为JSON,并使用它将JSON解析到NSDictionary中。