iTunes Connect에서 설정 한 적절한 소모품을 선택하여 nib 파일의 테이블에 표시하는 데 문제가 있습니다. (레이 Wenderlich의 튜토리얼을 사용)Objective C의 테이블에서 선택한 소모품을 표시하는 방법
나는 11 개의 소모품을 2 개의 다른 세트로 설정했다. 동전 및 카테고리.
내가하고 싶은 일은 각각 사용자를 다른 테이블로 데려가는 두 개의 버튼이 있다는 것입니다. 테이블에 따라 다른 세트가 표시됩니다.
나는 이것을 작동시키기 위해 수 시간 동안 노력했지만 나는 그것을 할 수 없다. 그래서 StackOverflow 커뮤니티의 힘을 빌려 도와줍니다. 다음과 같이
현재 내 설정은 다음과 같습니다
NSSet * productIdentifiers = [NSSet setWithObjects:
@"com.ac.scramble.coins1",
@"com.ac.scramble.coins2",
@"com.ac.scramble.coins3",
@"com.ac.scramble.coins4",
@"com.ac.scramble.coins5",
@"com.ac.scramble.category1",
@"com.ac.scramble.category3",
@"com.ac.scramble.category5",
@"com.ac.scramble.category8",
@"com.ac.scramble.category15",
@"com.ac.scramble.category30",
nil];
sharedInstance = [[self alloc] initWithProductIdentifiers:productIdentifiers
문제없이 아이튠즈에 연결을 통해 설정된다.
명백한 문제는 여기에 6 행을 표시하려는 첫 번째 펜촉에 위의 목록에서 마지막 6 개를 표시하고있는 것입니다 (처음 6 개가 아닌 마지막 6 개가 ...). 이것은 괜찮지 만 두 번째 펜촉에서는 5 개의 행을 표시하려고하는데 위 목록에서 마지막 5 개를 표시합니다. 나는 그것을 원하지 않는다. 나는 상위 5 위 (동전)를 보여주고 싶다.
NSSet을 두 개로 분할하고 통과 시키려고했지만 시도 할 수 없습니다. 내가 코드에서 어딘가에 내가 표시하고자하는 세트의 행을 지정할 수 있는지 모르겠습니다. 아마도 내가 속임수를 써야 할 곳인 관련 코드 (나는 믿는다)는 :
- (void)reload {
_products = nil;
[self.table2 reloadData];
[[RageIAPHelper sharedInstance] requestProductsWithCompletionHandler:^(BOOL success, NSArray *products) {
if (success) {
_products = products;
[self.table2 reloadData];
}
//[self.refreshControl endRefreshing];
}];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableCell";
SimpleTableCell *cell = (SimpleTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
SKProduct *product = (SKProduct *) _products[indexPath.row];
cell.nameLabel.text = product.localizedTitle;
NSLog(@"Localized title: %@", product.localizedTitle);
cell.thumbnailImageView.image = [UIImage imageNamed:[thumbnails3 objectAtIndex:indexPath.row]];
cell.descriptionLabel.text = [descriptions3 objectAtIndex:indexPath.row];
[_priceFormatter setLocale:product.priceLocale];
//cell.detailTextLabel.text = [_priceFormatter stringFromNumber:product.price];
cell.progressLabel.text = [_priceFormatter stringFromNumber:product.price];
cell.descriptionLabel.text = product.localizedDescription;
}
모두에게 감사드립니다.
집합 분할은 어떻게 작동하지 않습니까? NSPredicate를 사용하여 원하는 제품 만 필터링 할 수 있습니다. – Wain
안녕하세요, Wain - 내가하려는 것은 productIdentifiers와 productIdentifiers2를 생성하고 두 개의 sharedInstances를 호출하는 두 가지 일을합니다. 두 번째 호출 만 계산 했으므로 작동하지 않았습니다. 그런 다음 '동전 버튼을 클릭하고 나에게이 제품 식별자 세트를 제공하고, 그렇지 않으면 나에게 마지막으로 제공하십시오'라는 줄에서 도우미 클래스에 변수를 전달하려고 시도했습니다. 그 중 하나도 작동하지 않았습니다. 이 컨텍스트에서 NSPredicate를 사용한 적이 한번도 없습니다 - 여기에서 어떻게 사용하는지 설명 할 수 있습니까? 당신의 도움을 주셔서 감사합니다! – user1309044
NSSet은 순서가 지정되지 않으므로 그 안의 데이터를 "행"으로 생각하지 않는 것이 중요합니다. 나는 두 세트를 갖는 것이 좋습니다. 각 제품 유형별로 하나씩. – JonathanC