0

タブ付きビュー アプリケーションを作成し、CloudMade の API を使用しています。タブ付きビューにコピーしようとするシングルビューアプリケーションに作業中のプロジェクトがあります。

すべてをコピーして貼り付け、プロジェクトの設定とすべてをセットアップしました。タブ付きビュー FirstViewController は、古いシングル ビュー アプリとまったく同じです。アプリを実行すると、次のエラーが発生します。

Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [inf inf; nan nan]'

私はグーグルを試みましたが、何も出てきませんでした。初めてのタブ ビュー アプリなので、注意すべき点があるかどうかわかりません。ここにどのコード セクションまたはエラー レポートを貼り付けるかさえわかりません。どんな助けでも大歓迎です!どうもありがとう!

編集 2:例外スタック トレースは次のとおりです (と思います)。

2012-02-28 23:51:00.720 ParkerAssistant[1454:f803] CRASH: CALayer bounds contains NaN: [inf inf; nan nan]
2012-02-28 23:51:00.725 ParkerAssistant[1454:f803] Stack Trace: (
    0   CoreFoundation                      0x0156606e __exceptionPreprocess + 206
    1   libobjc.A.dylib                     0x01b1ad0a objc_exception_throw + 44
    2   CoreFoundation                      0x0150ea78 +[NSException raise:format:arguments:] + 136
    3   CoreFoundation                      0x0150e9e9 +[NSException raise:format:] + 57
    4   QuartzCore                          0x001df137 _ZN2CA5Layer10set_boundsERKNS_4RectEb + 215
    5   QuartzCore                          0x001d52fa -[CALayer setBounds:] + 156
    6   ParkerAssistant                     0x0003ee9a -[RMPath recalculateGeometry] + 927
    7   ParkerAssistant                     0x00002f55 -[ParkerAssistantFirstViewController viewDidLoad] + 1397
    8   UIKit                               0x003fd64e -[UIViewController view] + 184
    9   UIKit                               0x00418b89 -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 105
    10  UIKit                               0x004189bd -[UITabBarController transitionFromViewController:toViewController:] + 63
    11  UIKit                               0x00416f8a -[UITabBarController _setSelectedViewController:] + 339
    12  UIKit                               0x00416e2f -[UITabBarController setSelectedViewController:] + 169
    13  UIKit                               0x00414ffb -[UITabBarController _selectDefaultViewControllerIfNecessaryWithAppearanceTransitions:] + 192
    14  UIKit                               0x0041585a -[UITabBarController viewWillAppear:] + 148
    15  UIKit                               0x003fefbf -[UIViewController _setViewAppearState:isAnimating:] + 158
    16  UIKit                               0x003ff21b -[UIViewController __viewWillAppear:] + 62
    17  UIKit                               0x004000f1 -[UIViewController viewWillMoveToWindow:] + 253
    18  UIKit                               0x0036efec -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] + 592
    19  UIKit                               0x00374572 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 388
    20  UIKit                               0x0036e72b -[UIView(Hierarchy) addSubview:] + 56
    21  UIKit                               0x0035dbc2 -[UIWindow addRootViewControllerViewIfPossible] + 380
    22  UIKit                               0x0035dce2 -[UIWindow _setHidden:forced:] + 280
    23  UIKit                               0x0035dea8 -[UIWindow _orderFrontWithoutMakingKey] + 49
    24  UIKit                               0x00364d9a -[UIWindow makeKeyAndVisible] + 35
    25  UIKit                               0x00335be6 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1820
    26  UIKit                               0x003368a6 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 508
    27  UIKit                               0x00345743 -[UIApplication handleEvent:withNewEvent:] + 1027
    28  UIKit                               0x003461f8 -[UIApplication sendEvent:] + 68
    29  UIKit                               0x00339aa9 _UIApplicationHandleEvent + 8196
    30  GraphicsServices                    0x02398fa9 PurpleEventCallback + 1274
    31  CoreFoundation                      0x0153a1c5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
    32  CoreFoundation                      0x0149f022 __CFRunLoopDoSource1 + 146
    33  CoreFoundation                      0x0149d90a __CFRunLoopRun + 2218
    34  CoreFoundation                      0x0149cdb4 CFRunLoopRunSpecific + 212
    35  CoreFoundation                      0x0149cccb CFRunLoopRunInMode + 123
    36  UIKit                               0x003362a7 -[UIApplication _run] + 576
    37  UIKit                               0x00337a9b UIApplicationMain + 1175
    38  ParkerAssistant                     0x000024e8 main + 152
    39  ParkerAssistant                     0x00002445 start + 53
)
2012-02-28 23:51:00.726 ParkerAssistant[1454:f803] *** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN: [inf inf; nan nan]'
*** First throw call stack:
(0x1566052 0x1b1ad0a 0x150ea78 0x150e9e9 0x1df137 0x1d52fa 0x3ee9a 0x2f55 0x3fd64e 0x418b89 0x4189bd 0x416f8a 0x416e2f 0x414ffb 0x41585a 0x3fefbf 0x3ff21b 0x4000f1 0x36efec 0x374572 0x36e72b 0x35dbc2 0x35dce2 0x35dea8 0x364d9a 0x335be6 0x3368a6 0x345743 0x3461f8 0x339aa9 0x2398fa9 0x153a1c5 0x149f022 0x149d90a 0x149cdb4 0x149cccb 0x3362a7 0x337a9b 0x24e8 0x2445)
terminate called throwing an exception

編集 3: viewDidLoad メソッド:

- (void)viewDidLoad {
    [super viewDidLoad];
    locationManager = [[CLLocationManager alloc] init];
    locationManager.distanceFilter = kCLDistanceFilterNone;
    locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    locationManager.delegate = self;
    [locationManager startUpdatingLocation];

    id cmTilesource = [[RMCloudMadeMapSource alloc] initWithAccessKey:@"dfd3baf1ceda40ff8b4bf4b55303253d" styleNumber:1];
    [[RMMapContents alloc] initWithView:mapView tilesource: cmTilesource];
    tokenManager = [[TokenManager alloc] initWithApikey:@"dfd3baf1ceda40ff8b4bf4b55303253d"];
    _routingManager = [[CMRoutingManager alloc] initWithMapView:mapView tokenManager:tokenManager];

    _routingManager.delegate = self;

    int width = self.view.frame.size.width;
    int height = 64;
    _rifRect = CGRectMake(0, 0, width, height);
    _firCenter = CGPointMake(width/2,height/2);

    route = [[RMPath alloc] initForMap:mapView];

    route.lineColor = [UIColor blueColor];
    route.fillColor = [UIColor clearColor];
    route.lineWidth = 5;
    route.scaleLineWidth = NO;

    _rif = [[CMRouteInfoView alloc] init:_rifRect :nil];
    _rif.center = _firCenter;
    _rif.autoresizingMask = UIViewAutoresizingFlexibleWidth;

    _rif.delegate = self;
}

EDITこんにちは、タブ付きのView Controllerはそれとは何の関係もないようです。新しい単一ビュー アプリケーション用に再度コピーしましたが、再び機能しません。おそらく、作業中のアプリはストーリーボードを使用せず、単一の xib ファイルのみを使用することに言及する必要があります (以前は違いはないと思いました) 。2が機能していません(タブ付きおよび単一ビュー)どこから始めれ ばよいかさえわかりません..ありがとう

4

3 に答える 3

1

問題は、マップ アウトレットである mapView をストーリーボードの RMMapView オブジェクトにリンクしていなかったことです。今、それは働いています。

于 2012-02-29T01:09:24.460 に答える
0

-[ParkerAssistantFirstViewController viewDidLoad]メソッドでは、recalculateGeometryメッセージをのインスタンスに送信しますRMPathRMPath次に、の境界を設定しますCALayer

例外メッセージを見るとRMPath、レイヤーの境界が長方形に設定されていることがわかります[inf inf; nan nan]。この単語infは「無限大」の略であるため、長方形の原点は無限大にあります。この単語nanは「数字ではない」という意味なので、長方形のサイズは完全に無効です。それがCALayer不平を言っていることです。

最初の編集で変数を見ると、それscaleは0であることがわかります。それは疑わしいです。それがビューのズーム率である場合は、おそらく無効です。それを制御できる場合は、1(またはその他の小さな正の数)に設定してみてください。

于 2012-02-28T23:10:27.217 に答える
-1

QuartzCore.framework をリンクしましたか? CALayer には QuartzCore が必要だと確信しています。これを行うには、[ターゲット] --> [ビルド フェーズ] タブ -- [バイナリをライブラリにリンク] を選択します。プラス記号をクリックし、一番下までスクロールして QuartzCore を選択し、プロジェクトにリンクします。

QuartzCore フレームワークのリンク

ここに画像の説明を入力

于 2012-02-28T17:43:14.540 に答える