0

そのため、スタンドアロン プロジェクトとして完全に機能するスタンドアロン コンパス アプリ (固定緯度/経度ポイントを指すように回転する矢印) を開発しましたが、それをより広いプロジェクトに組み込むと問題が発生します。

最初に、次のセマンティック警告 (「CLLoccation *__strong」から「CLLocationManager*」に割り当てられている互換性のないポインター型) が表示されます。

- (void)locationManager:(CLLocationManager *)manager 
didUpdateToLocation:(CLLocation *)newLocation 
       fromLocation:(CLLocation *)oldLocation {

if (newLocation.horizontalAccuracy >= 0) {

    self.recentLocation = newLocation; (WARNING HERE)

CLLocation *POI2location = [[CLLocation alloc]
                                initWithLatitude:kPOI2Latitude 
                                longitude:kPOI2Longitude];
    CLLocationDistance delta = [POI2location 

                                distanceFromLocation:newLocation];

さらに、次の場合に致命的なエラーが発生します (タイプ「CLLocationManager のオブジェクトにプロパティ「座標」が見つかりません)。

- (void)locationManager:(CLLocationManager *)manager
   didUpdateHeading:(CLHeading *)newHeading {

if (self.recentLocation != nil && newHeading.headingAccuracy >= 0) {
    CLLocation *POI2Location = [[CLLocation alloc]
                                initWithLatitude:kPOI2Latitude
                                longitude:kPOI2Longitude];

    double course = [self headingToLocation:POI2Location.coordinate
                                    current:recentLocation.coordinate]; (WARNING HERE)

以前はすべて完全に機能していたのに、何らかの理由で「recentLocation」が今は好きではありません。誰かが私に欠けているものを指摘できますか。私よりも経験のある人には明らかだと思います。

よろしくお願いします。

4

1 に答える 1

0

今朝また始めて、答えは私を見つめています!

私が入れた.hファイルに

@property (strong, nonatomic) CLLocationManager *recentLocation;

いつ置くべきだったのか

@property (strong, nonatomic) CLLocation *recentLocation;
于 2012-06-22T09:25:13.680 に答える