Wikitude does not work. Poi do not change the position on phone position change

496 views Asked by At

I am trying to integrate AR poi view with Wikitude in my app. As html I used a file from the example 4_PointOfInterest_4_SelectingPois. It should render a few point around my location. It does it, but all points stay in the same position all the time, although I changed my phone position. I do not have any errors in the console. How can I fix it ?

My code:

#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]);
}

Current result: enter image description here

1

There are 1 answers

0
Łukasz Tomaszewski On BEST ANSWER

On some iPhone compass does not work properly, to fix it is required to reset location settings with iPhone Settings > General > Reset > Reset Location & Privacy. After that the application started to work without any code change.

The solution was found by Roman Wueest at http://www.wikitude.com/developer/developer-forum/-/message_boards/message/665750?p_p_auth=XO5dD4BU