App Store链接未在UIAlertView中打开

时间:2010-12-12 15:13:34

标签: objective-c uialertview

此App Store链接无法正常工作(按下时没有任何反应)

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
        id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section];
        rowsNumber = [NSNumber numberWithUnsignedInteger:sectionInfo.numberOfObjects];
        if ([rowsNumber intValue] > 1) {
            textField.hidden = YES;

            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"An Alert!" 
                                                           delegate:self
                                                  cancelButtonTitle:@"OK"
                                                  otherButtonTitles:@"Buy Full Version", nil];
            [alert show];
            [alert release];

        }
        NSLog(@"%d", [rowsNumber intValue]);
        return [sectionInfo numberOfObjects];
    }

    - (void) alertView:(UIAlertView *) alertView buttonClickedAtIndex:(NSInteger) index {
        if(index == 1) {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://phobos.apple.com/gb/app/stalk-it/id405797470?mt=8"]];
        }
    }

1 个答案:

答案 0 :(得分:3)

尝试更改......

- (void) alertView:(UIAlertView *) alertView buttonClickedAtIndex:(NSInteger) index

为...

- (void) alertView:(UIAlertView *) alertView clickedButtonAtIndex:(NSInteger) index