【问题标题】:Wikitude does not work. Poi do not change the position on phone position change维基不工作。 Poi 不改变手机位置变化的位置
【发布时间】:2015-06-13 08:29:25
【问题描述】:

我正在尝试在我的应用程序中将 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]);
}

当前结果:

【问题讨论】:

    标签: ios objective-c ios8 augmented-reality wikitude


    【解决方案1】:

    在某些 iPhone 指南针上无法正常工作,要修复它需要使用 iPhone Settings &gt; General &gt; Reset &gt; Reset Location &amp; Privacy 重置位置设置。之后,应用程序无需任何代码更改即可开始工作。

    Roman Wueest 在http://www.wikitude.com/developer/developer-forum/-/message_boards/message/665750?p_p_auth=XO5dD4BU找到了解决方案

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-16
      • 2020-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多