簡體   English   中英

使用Apportable將iOS應用轉換為Android-構建時出現各種參考和定義錯誤

[英]Convert iOS app to Android using Apportable - various reference and definition errors when building

我正在嘗試使用Apportable轉換iOS應用程序。

不幸的是,使用命令apportable build時遇到一些錯誤。 我曾嘗試過Google並在StackOverflow上搜索有關此問題的解決方案。 發現在configuration.json中添加“ add_params”可能會有所幫助,但這不起作用,我也不知道該在其中添加什么。 構建輸出:

Packaging resources.
scons: *** [assets/ResourceRules.plist] Source `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/ResourceRules.plist' not found, needed by target `assets/ResourceRules.plist'.
Build/android-armeabi-debug/Cromian.CHASER/Chaser/libChaser.a(ChooseShoppingLocationViewController.m.o):/Users/Anders/Documents/Xcode/iOS_code/Cromian/Chaser/chaser_app/Chaser/ChooseShoppingLocationViewController.m:function L_OBJC_CLASSLIST_REFERENCES_$_54: error: undefined reference to 'OBJC_CLASS_$_MKPointAnnotation'
Build/android-armeabi-debug/Cromian.CHASER/Chaser/libChaser.a(ChooseShoppingLocationViewController.m.o):/Users/Anders/Documents/Xcode/iOS_code/Cromian/Chaser/chaser_app/Chaser/ChooseShoppingLocationViewController.m:function L_OBJC_CLASSLIST_REFERENCES_$_94: error: undefined reference to 'OBJC_CLASS_$_MKUserLocation'
Build/android-armeabi-debug/Cromian.CHASER/Chaser/libChaser.a(ChooseShoppingLocationViewController.m.o):/Users/Anders/Documents/Xcode/iOS_code/Cromian/Chaser/chaser_app/Chaser/ChooseShoppingLocationViewController.m:function L_OBJC_CLASSLIST_REFERENCES_$_99: error: undefined reference to 'OBJC_CLASS_$_MKPinAnnotationView'
scons: *** [Build/android-armeabi-debug/Chaser/apk/lib/armeabi/libverde.so] Error 1
scons: building terminated because of errors.
Anders-Friis-MacBook-Pro:chaser_app Anders$ 

我仍然對MKPointAnnotationMKUserLocationMKPinAnnotationView有問題。 它們用於以下類別:

ChooseShoppingLocationViewController.h

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import "NotificationController.h"

@interface ChooseShoppingLocationViewController : UIViewController <MKMapViewDelegate>
@property (strong, nonatomic) CLLocation *shoppingLocation;
@end

ChooseShoppingLocationViewController.m

@interface ChooseShoppingLocationViewController ()
@property (strong, nonatomic) IBOutlet MKMapView *mapView;
@property (strong, nonatomic) MKPointAnnotation *shoppingLocationAnnotation;
@end

...

- (MKPointAnnotation *)getNewShoppingLocationAnnotation
{
    MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
    annotation.title = YOUR_SHOPPING_AREA_TEXT;
    return annotation;
}

...

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
    userLocation.title = @"";
    CLLocationCoordinate2D location = [userLocation coordinate];
    MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(location, DISTANCE_SPAN, DISTANCE_SPAN);

    if (self.isFirstUserLocation) {
        dispatch_queue_t animateQueue = dispatch_queue_create("show user location", NULL);
        dispatch_async(animateQueue, ^{
            sleep(1.0);
            dispatch_async(dispatch_get_main_queue(), ^{
                [self.mapView setRegion:region animated:YES];
                [self.mapView selectAnnotation:self.shoppingLocationAnnotation animated:YES];
            });
        });
        self.isFirstUserLocation = NO;
    }
}

- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id < MKAnnotation >)annotation {
    if ([annotation isKindOfClass:[MKUserLocation class]]) {
        return nil;
    }

    MKPinAnnotationView *pinView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"DETAILPIN_ID"];
    [pinView setAnimatesDrop:YES];
    [pinView setCanShowCallout:YES];
    [pinView setSelected:YES];
    return pinView;
}

現在是否可以將這些類與Apportable一起使用?

順便說一句,如果我嘗試刪除這些類的使用,我仍然會收到錯誤:

scons: *** [assets/ResourceRules.plist] Source `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/ResourceRules.plist' not found, needed by target `assets/ResourceRules.plist'.
scons: building terminated because of errors.

重復的符號錯誤表明StoreViewAnnotation.m和main.m中都定義了StoreViewAnnotation。 main.m是否導入StoreViewAnnotation.m而不是StoreViewAnnotation.h?

ChooseShoppingLocationViewController.m錯誤看起來像是應用程序中缺少的符號。

關於_UIRefreshControl的錯誤是因為UIRefreshControl尚未在Apportable平台中實現。 現在,您需要對其進行存根處理。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM