我正在尝试将AR poi视图与Wikitude整合到我的应用中。作为html我使用了示例4_PointOfInterest_4_SelectingPois
中的文件。它应该在我的位置周围呈现几点。虽然我改变了我的手机位置,但它确实能够保持在同一位置。我在控制台中没有任何错误。我该如何解决?
我的代码:
#import "ViewController.h"
#import <WikitudeSDK/WikitudeSDK.h>
#import "PureLayout.h"
@interface ViewController () <WTArchitectViewDelegate>
@property (nonatomic, strong) WTArchitectView *architectView;
@property (nonatomic, weak) WTNavigation *architectWorldNavigation;
@property (nonatomic, weak) IBOutlet UIView *augmentedViewContainer;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSError *deviceNotSupportedError = nil;
if ( [WTArchitectView isDeviceSupportedForRequiredFeatures:WTFeature_Geo | WTFeature_2DTracking error:&deviceNotSupportedError] ) { // 1
self.architectView = [[WTArchitectView alloc] initWithFrame:CGRectZero motionManager:nil];
self.architectView.delegate = self;
[self.architectView setLicenseKey:@"<LICENSE_KEY>"];
self.architectWorldNavigation = [self.architectView loadArchitectWorldFromURL:[[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html" subdirectory:@"4_PointOfInterest_4_SelectingPois"] withRequiredFeatures:WTFeature_Geo];
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
if (self.architectWorldNavigation.wasInterrupted) {
[self.architectView reloadArchitectWorld];
}
[self startRunning];
}];
[[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillResignActiveNotification
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *note) {
[self startRunning];
}];
[self.augmentedViewContainer addSubview:self.architectView];
[self.architectView autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
} else {
NSLog(@"device is not supported - reason: %@", [deviceNotSupportedError localizedDescription]);
}
}
- (void)startRunning {
if ( ![self.architectView isRunning] ) {
[self.architectView start:^(WTStartupConfiguration *configuration) {
} completion:^(BOOL isRunning, NSError *error) {
if ( !isRunning ) {
NSLog(@"WTArchitectView could not be started. Reason: %@", [error localizedDescription]);
}
}];
}}
- (void)pauseRunning {
if ( [self.architectView isRunning] ) {
[self.architectView stop];
}}
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark - Delegation
#pragma mark WTArchitectViewDelegate
- (void)architectView:(WTArchitectView *)architectView didFinishLoadArchitectWorldNavigation:(WTNavigation *)navigation {
NSLog(@"didFinishLoadArchitectWorldNavigation");
}
- (void)architectView:(WTArchitectView *)architectView didFailToLoadArchitectWorldNavigation:(WTNavigation *)navigation withError:(NSError *)error {
NSLog(@"Architect World from URL '%@' could not be loaded. Reason: %@", navigation.originalURL, [error localizedDescription]);
}
#pragma mark WTArchitectViewDebugDelegate
- (void)architectView:(WTArchitectView *)architectView didFailCaptureScreenWithError:(NSError *)error {
NSLog(@"didFailCaptureScreenWithError %@",error);
}
- (void)architectView:(WTArchitectView *)architectView didEncounterInternalError:(NSError *)error {
NSLog(@"WTArchitectView encountered an internal error '%@'", [error localizedDescription]);
}
目前的结果:
答案 0 :(得分:0)
在某些iPhone指南针上无法正常工作,要修复它需要使用iPhone Settings > General > Reset > Reset Location & Privacy
重置位置设置。之后,应用程序开始工作,没有任何代码更改。
解决方案由Roman Wueest在http://www.wikitude.com/developer/developer-forum/-/message_boards/message/665750?p_p_auth=XO5dD4BU
找到