相关疑难解决方法(0)

XCode4和核心数据:如何启用SQL调试

我正在开发一个通用的iOS应用程序,我想在调试时看到日志中的原始SQL.这篇博客文章中有一些关于如何为iOS Core Data开发启用原始SQL日志记录的信息.给出的示例适用于XCode 3,我不清楚如何在XCode 4中启用它.

我尝试了"产品" - >"编辑方案",并将" -com.apple.CoreData.SQLDebug 1 " 添加到"启动时传递的参数",但我仍然没有在日志中看到任何输出.不确定我是在寻找错误的地方还是仅仅错误地传递了参数.

sql core-data ios xcode4

101
推荐指数
3
解决办法
4万
查看次数

如何在核心数据中应用group by子句

我正在实现tableview,我想在tableview的部分显示类名,我试图从使用核心数据实现的数据库中获取类值,我想在classname上使用group by子句获取数据这是我的代码

   AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
    //create managed object context
    NSManagedObjectContext *context = [appDelegate managedObjectContext];


    NSFetchRequest* fetch = [NSFetchRequest fetchRequestWithEntityName:@"Boking_Detail"];
    NSEntityDescription* entity = [NSEntityDescription entityForName:@"Boking_Detail"
                                              inManagedObjectContext:context];
    NSAttributeDescription* clsName = [entity.attributesByName objectForKey:@"classname"];
    NSAttributeDescription* clsDate = [entity.attributesByName objectForKey:@"classdate"];
    NSAttributeDescription* startTime = [entity.attributesByName objectForKey:@"starttime"];
    NSAttributeDescription* endTime = [entity.attributesByName objectForKey:@"endtime"];

    NSExpressionDescription *expressionDescription = [[NSExpressionDescription alloc] init];
    [expressionDescription setName: @"count"];
   // [expressionDescription setExpression: countExpression];
    [expressionDescription setExpressionResultType: NSInteger32AttributeType];
    [fetch setPropertiesToFetch:[NSArray arrayWithObjects:clsName,clsDate,startTime,endTime, expressionDescription, nil]];
    [fetch setPropertiesToGroupBy:[NSArray arrayWithObject:clsName]];
    [fetch setResultType:NSDictionaryResultType];
    NSError* error = nil;
    NSArray *results …
Run Code Online (Sandbox Code Playgroud)

iphone core-data objective-c ios

2
推荐指数
1
解决办法
3355
查看次数

标签 统计

core-data ×2

ios ×2

iphone ×1

objective-c ×1

sql ×1

xcode4 ×1