これは私の最初のプロジェクトであり、すべてこれを見てもまだ新しいです。しかし、私はスタックオーバーフローコミュニティに完全な信念を持っています。NSloggingとNSString Conundrum
私はあなたのためにかなり興味深い謎を持っています。私は標準を呼ぶ:私のテーブルビューで
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
それはビューコントローラをプッシュしていて、文字列(下記の方法)の値を更新する(文字列の変化は異なる方法でNSLoggedさ):
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
appDelegate.baseURL = nil;
musicInteractionController = [[xSheetMusicViewController alloc]init];
if (indexPath.row == 0 && indexPath.section == 0) {
appDelegate.baseURL = @"mussette.pdf";
[self.navigationController pushViewController:musicInteractionController animated:YES];
}
else if (indexPath.row == 1 && indexPath.section == 0) {
appDelegate.baseURL = @"Importing PDF's.pdf";
[self.navigationController pushViewController:musicInteractionController animated:YES];
}
else if (indexPath.row == 2 && indexPath.section == 0) {
appDelegate.baseURL = @"Example.pdf";
[self.navigationController pushViewController:musicInteractionController animated:YES];
}
else if (indexPath.section == 1) {
appDelegate.baseURL = [[ivContentsList objectAtIndex:indexPath.row]lastPathComponent];
[self.navigationController pushViewController:musicInteractionController animated:YES];
}
[musicInteractionController release]; musicInteractionController = nil;
appDelegate.baseURL = nil;
マイコードには、エラー、警告、またはメモリリークはありません。そして、現在のPDFを表示するためにビューを更新する新しいView Controllerによって読み取られた文字列の変更。これは正しく動作しますが、NSLog値の変更にもかかわらず、同じPDFを繰り返し表示し続けます。役立つ場合は、実際のデバイスではなくiOSシミュレータを使用しています。
ここでは、最初のセルをプッシュした後のNSLogサンプルを示します。次に、nilビューのコントローラログを無視します(バグだと思います)。また、無視されCGContextClipToRectを解決することができるものにボーナス:無効なコンテキスト0x0の警告):事前に
2011-09-15 16:24:23.731 SheetMuse[43068:b603] value - (null)
Sep 15 16:24:27-MacBook SheetMuse[43068] <Error>: CGContextClipToRect: invalid context 0x0
Sep 15 16:24:27-MacBook SheetMuse[43068] <Error>: CGContextGetClipBoundingBox: invalid context 0x0
Sep 15 16:24:27-MacBook SheetMuse[43068] <Error>: CGContextConcatCTM: invalid context 0x0
Sep 15 16:24:27-MacBook SheetMuse[43068] <Error>: CGBitmapContextCreateImage: invalid context 0x0
2011-09-15 16:24:27.050 SheetMuse[43068:b603] Application tried to push a nil view controller on target <UINavigationController: 0x4c5e220>.
2011-09-15 16:24:27.069 SheetMuse[43068:b603] value - mussette.pdf
2011-09-15 16:24:27.072 SheetMuse[43068:b603] Application tried to push a nil view controller on target <UINavigationController: 0x4e74620>.
2011-09-15 16:24:27.097 SheetMuse[43068:b603] value - mussette.pdf
2011-09-15 16:24:33.944 SheetMuse[43068:b603] Down
Sep 15 16:24:36 MacBook-SheetMuse[43068] <Error>: CGContextClipToRect: invalid context 0x0
Sep 15 16:24:36 MacBook-SheetMuse[43068] <Error>: CGContextGetClipBoundingBox: invalid context 0x0
Sep 15 16:24:36 MacBook-SheetMuse[43068] <Error>: CGContextConcatCTM: invalid context 0x0
Sep 15 16:24:36 MacBook-SheetMuse[43068] <Error>: CGBitmapContextCreateImage: invalid context 0x0
2011-09-15 16:24:36.587 SheetMuse[43068:b603] Application tried to push a nil view controller on target <UINavigationController: 0x4c54bf0>.
2011-09-15 16:24:36.588 SheetMuse[43068:b603] value - Importing PDF's.pdf
2011-09-15 16:24:36.590 SheetMuse[43068:b603] Application tried to push a nil view controller on target <UINavigationController: 0x4c50790>.
2011-09-15 16:24:36.591 SheetMuse[43068:b603] value - Importing PDF's.pdf
感謝。ここで
のための問題を修正し、どのような方法それはappDelegate.baseURLを読み込み、pdfを読み込みますか?その方法を示してください。 – Anna
遅れて申し訳ありません。 appDelegate.baseURLは、NSURLからCFURLRefとして次のビューの - (id)initメソッドにロードされます。 – CodaFi
上記のコードでは、baseURLは_after_ initが設定されているので、initが実行されると前の値を読み込みます。 – Anna