摘要:
#pragma mark 解析XML数据- (NSArray *)parseXMLData:(NSData *)data error:(NSString **)error{ NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data]; // 设置代理 parser.delegate = self; // 开始解析(阻塞式方法) [parser parse]; [parser release]; // 说明有错误信息 if (_error) { *error = _error; } return _videos;}#pragma m 阅读全文
摘要:
//运行时调用- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{}//进入前台- (void)applicationWillEnterForeground:(UIApplication *)application{}//进入后台- (void)applicationDidEnterBackground:(UIApplication *)application{}//激活- (void)applicationDidBecomeAc 阅读全文
摘要:
1 self.data = [NSMutableData data]; 2 3 NSURL *url = [NSURL URLWithString:@"http://192.168.1.106:8080/MJServer/login"]; 4 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; 5 6 request.HTTPMethod = @"POST"; 7 8 // 设置请求体 9 NSString *param = @"... 阅读全文
摘要:
// 从应用程序包中加载模型文件NSManagedObjectModel *model = [NSManagedObjectModel mergedModelFromBundles:nil];// 传入模型对象,初始化NSPersistentStoreCoordinatorNSPersistentStoreCoordinator *psc = [[[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:model] autorelease];// 构建SQLite数据库文件的路径NSString *docs = [NSSe 阅读全文
摘要:
#pragma mark 打开数据库- (void)openDB { // 数据库文件路径 NSString *filename = [@"sqlite.db" documentsAppend]; // 如果数据库不存在,就会创建一个 int result = sqlite3_open([filename UTF8String], &_db); if (result == SQLITE_OK) { NSLog(@"打开数据库成功!"); }}#pragma mark 创建表- (void)createTables { char *sql = &q 阅读全文