我使用NSFetchResultsController在UITableView中显示100,000 +记录.这有效,但它很慢,特别是在iPad 1上.加载可能需要7秒钟,这对我的用户来说是一种折磨.
我也希望能够使用部分,但这至少会增加3秒的时间.
这是我的NSFetchResultsController:
- (NSFetchedResultsController *)fetchedResultsController {
if (self.clientsController != nil) {
return self.clientsController;
}
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Client" inManagedObjectContext:self.managedObjectContext];
[request setEntity:entity];
[request setPredicate:[NSPredicate predicateWithFormat:@"ManufacturerID==%@", self.manufacturerID]];
[request setFetchBatchSize:25];
NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:@"UDF1" ascending:YES];
NSSortDescriptor *sort2= [[NSSortDescriptor alloc] initWithKey:@"Name" ascending:YES];
[request setSortDescriptors:[NSArray arrayWithObjects:sort, sort2,nil]];
NSArray *propertiesToFetch = [[NSArray alloc] initWithObjects:@"Name", @"ManufacturerID",@"CustomerNumber",@"City", @"StateProvince",@"PostalCode",@"UDF1",@"UDF2", nil];
[request setPropertiesToFetch:propertiesToFetch];
self.clientsController =
[[NSFetchedResultsController alloc] initWithFetchRequest:request
managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil
cacheName:nil];
return self.clientsController;
}
Run Code Online (Sandbox Code Playgroud)
我有一个在我的NSPredicate中使用的ManufacturerID索引.这看起来像一个非常基本的NSFetchRequest - 我能做些什么来加快这个速度?或者我刚刚达到了限制?我肯定错过了什么.
所以我在SP中有一些非常慢的查询我需要加速,我一直在使用OPTIMIZE FOR UNKNOWN并且看到性能急剧上升.我仍然有一个查询真的很慢,我想应用它但它包含一个2个SQL查询的UNION,所以我的问题是我是否应用OPTIMIZE FOR UNKNOWN?
这是我的SP清晰度的简单版本:
SELECT * FROM MyTable ManufacturerID=@ManufacturerID and tStamp > @tStamp
OPTION (OPTIMIZE FOR (@ManufacturerID UNKNOWN, @tStamp UNKNOWN))
UNION
SELECT * FROM MyTable ManufacturerID=@ManufacturerID
OPTION (OPTIMIZE FOR (@ManufacturerID UNKNOWN)
Run Code Online (Sandbox Code Playgroud)
这是现在的实际SP:
SELECT * FROM (
SELECT ROW_NUMBER() OVER(ORDER BY Products.ItemID) AS RowNum, *
FROM
(
SELECT Products.ProductID, Products.ItemID, Products.ManufacturerID,
CategoryID = NULL, CategoryName = NULL,
CategoryProductID = NULL, Products.ItemName, Products.Description, Products.Notes,
Products.Dimensions, Products.BasePrice, Products.OrderMinimumQuantity,
ContainerMinimumQuantity =
CASE COALESCE(Products.ContainerMinQty, 0)
WHEN 0 THEN Products.OrderMinimumQuantity
ELSE Products.ContainerMinQty
END
, …Run Code Online (Sandbox Code Playgroud) 根据此处的文档:https: //developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v3/020_key_concepts/0700_other_topics#SalesItemLineDetail
我应该能够设置UnitPrice,以便我的发票显示UnitPrice,Qty和SubTotal.
我的发票工作很好,但我错过了这条重要的信息,这是我在发票上生成一条线的代码:
foreach (var i in orderItems)
{
Line invLine = new Line();
invLine.Id = i.ItemID;
invLine.Amount = i.SubTotal.Value;
invLine.AmountSpecified = true;
invLine.Description = i.ItemName;
invLine.DetailType = LineDetailTypeEnum.SalesItemLineDetail;
invLine.DetailTypeSpecified = true;
SalesItemLineDetail silDetails = new SalesItemLineDetail();
silDetails.Qty = i.Qty;
silDetails.QtySpecified = true;
silDetails.ItemRef = new ReferenceType() { Value = i.ItemID };
invLine.AnyIntuitObject = silDetails;
invoice.Line[lineCount] = invLine;
lineCount += 1;
}
Run Code Online (Sandbox Code Playgroud)
有人有这个工作吗?我在这里错过了什么?
我正在使用Azure Service Bus Queue从我的应用程序发送电子邮件.我有许多不同的客户通过我的应用程序发送电子邮件,每条消息都有一个标识该客户的属性:CustomerID
我需要为我的客户编写一个管理区域来查看队列中的待处理消息,更重要的是查看deadletter队列.我不希望他们看到每个人的紧张,所以我想根据属性CompanyID过滤消息.
我该如何做到这一点?
我阅读了有关主题和订阅的内容,但我至少每周增加10位以上的客户,这对我来说不是一个合理的解决方案.
当我的点击手势触发时,我需要发送一个额外的参数,但我必须做一些非常愚蠢的事情,我在这里做错了什么:
这是我创建和添加的手势:
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:itemSKU:)];
tapGesture.numberOfTapsRequired=1;
[imageView setUserInteractionEnabled:YES];
[imageView addGestureRecognizer:tapGesture];
[tapGesture release];
[self.view addSubview:imageView];
Run Code Online (Sandbox Code Playgroud)
这是我处理它的地方:
-(void) handleTapGesture:(UITapGestureRecognizer *)sender withSKU: (NSString *) aSKU {
NSLog(@"SKU%@\n", aSKU);
}
Run Code Online (Sandbox Code Playgroud)
并且由于UITapGestureRecognizer init行而无法运行.
我需要知道可以识别哪些图像被点击的东西.
我想在我的UIView代码中调用某个方法,每5分钟说一次 - 我该如何实现?
在我的应用程序中,我将所有这些NSFetchRequests用于遍布不同视图控制器的相同NSManagedObjects,这对我来说似乎很疯狂,是否有一个很好的数据访问模式,可以将我需要的内容放在一个地方?
我正在尝试FMDB,如果我可以将我的FMResultSet变成NSMutableArray,它看起来对我来说是完美的.
我怎么做到这一点?
我有一个我需要引用的错误代码列表,有点像这样:
Code / Error Message
A01 = whatever error
U01 = another error
U02 = yet another error type
Run Code Online (Sandbox Code Playgroud)
我通过Web服务调用将代码返回给我,我需要显示或获取可读错误.所以我在传递一个返回可读描述的代码时需要一个函数.我只是想做一个选择案例,但认为他们可能是一个更好的方法.这样做的最好的方法/最有效的方法是什么?
我最后在我的.h和.m文件中都有这些,这是我的第一个Objective-C程序,所以我想要一些澄清,所以我可以清理这些东西.
ipad ×4
iphone ×4
objective-c ×4
asp.net ×2
c# ×2
core-data ×2
ios ×2
azure ×1
fmdb ×1
quickbooks ×1
servicebus ×1
sql-server ×1
vb.net ×1