[英]Convert iOS app to Android using Apportable - various reference and definition errors when building
I am trying to convert an iOS app using Apportable
. 我正在尝试使用
Apportable
转换iOS应用程序。
Unfortunately i am facing some errors when building using the command apportable build
. 不幸的是,使用命令
apportable build
时遇到一些错误。 I have tried to Google and search on StackOverflow for solutions on the problem. 我曾尝试过Google并在StackOverflow上搜索有关此问题的解决方案。 Found out that adding "add_params" in the configuration.json could help but that doesn't work and i don't exactly know what to add there.
发现在configuration.json中添加“ add_params”可能会有所帮助,但这不起作用,我也不知道该在其中添加什么。 The build output:
构建输出:
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$
I still have problems with MKPointAnnotation
, MKUserLocation
and MKPinAnnotationView
. 我仍然对
MKPointAnnotation
, MKUserLocation
和MKPinAnnotationView
有问题。 They are used in the following class: 它们用于以下类别:
ChooseShoppingLocationViewController.h 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 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;
}
Is it now allowed to use these classes with Apportable
? 现在是否可以将这些类与
Apportable
一起使用?
Btw if i try to remove the use of these classes i am still getting the error: 顺便说一句,如果我尝试删除这些类的使用,我仍然会收到错误:
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.
The duplicate symbol errors indicate that StoreViewAnnotation is defined both in StoreViewAnnotation.m and main.m. 重复的符号错误表明StoreViewAnnotation.m和main.m中都定义了StoreViewAnnotation。 Does main.m import StoreViewAnnotation.m instead of StoreViewAnnotation.h?
main.m是否导入StoreViewAnnotation.m而不是StoreViewAnnotation.h?
The ChooseShoppingLocationViewController.m errors look like a missing symbol in the app. ChooseShoppingLocationViewController.m错误看起来像是应用程序中缺少的符号。
The error about _UIRefreshControl is because UIRefreshControl is not yet implemented in the Apportable platform. 关于_UIRefreshControl的错误是因为UIRefreshControl尚未在Apportable平台中实现。 For now, you'll need to stub around it.
现在,您需要对其进行存根处理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.