Wikitude 不起作用。 Poi 不改变 phone 位置变化的位置
Wikitude does not work. Poi do not change the position on phone position change
我正在尝试在我的应用程序中将 AR poi 视图与 Wikitude 集成。作为 html,我使用了示例 4_PointOfInterest_4_SelectingPois
中的文件。它应该在我的位置周围呈现几个点。它做到了,但是所有的点一直都在同一个位置,尽管我改变了我的 phone 位置。我在控制台中没有任何错误。我该如何解决?
我的代码:
#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]);
}
当前结果:
在某些 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
找到了解决方案
我正在尝试在我的应用程序中将 AR poi 视图与 Wikitude 集成。作为 html,我使用了示例 4_PointOfInterest_4_SelectingPois
中的文件。它应该在我的位置周围呈现几个点。它做到了,但是所有的点一直都在同一个位置,尽管我改变了我的 phone 位置。我在控制台中没有任何错误。我该如何解决?
我的代码:
#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]);
}
当前结果:
在某些 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
找到了解决方案