Hi,
 
At the moment we're setting up a new and much better forum for you, so we can provide even better support! This is why this forum is in ‘read-only' mode for as long as we're migrating the content.
 
Please visit our brand new forum at https://support.wikitude.com to report your issues.
 
Should you wait for an urgent answer, please contact us via forum@wikitude.com (make sure to include the title of your post, so we can help you more efficiently).
 
Thank you,
The Wikitude Team
« Back

memory architectview IOS

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
memory architectview IOS
Answer
11/6/16 8:06 PM

Hi,

i make an ios app with 10 video in local files. I used a firts viewcontroller to make introduction, but when i move view in my two pages, memory of my app grow very high, because when i open arview memory add 40 MO at each time.... ANd  after , application crashed. Destroy my model dont change anything.  Is there a solution to dealloc my Arview to clear memory? what is the way to use ?

 

Thanks

 

Cédric FRY


RE: memory architectview IOS
Answer
11/6/16 8:33 PM as a reply to ced fry.

ANd i Use Clearcache in wikitude.


RE: memory architectview IOS
Answer
11/6/16 10:36 PM as a reply to ced fry.

Probably the same problem with "Wikitude SDK DETECTED MULTIPLE SDK ALLOCATIONS" wich appear...

 


RE: memory architectview IOS
Answer
11/6/16 11:44 PM as a reply to ced fry.

these is my viewcontroller

//

//  ViewController.h

//  AugmentedRealityApplication

//

//  Created by Wikitude GmbH on 22/04/15.

//  Copyright (c) 2015 Wikitude. All rights reserved.

//

 

#import <UIKit/UIKit.h>

 

 

@interface ViewController : UIViewController

 

@property (weak, nonatomic) IBOutlet UIButton *back;

- (IBAction)backbutton:(id)sender;

 

 

@end

 

 

and this is my viewcontroller.m

//

//  ViewController.m

//  AugmentedRealityApplication

//

//  Created by Wikitude GmbH on 22/04/15.

//  Copyright (c) 2015 Wikitude. All rights reserved.

//

 

#import "ViewController.h"

 

#import <WikitudeSDK/WikitudeSDK.h>

/* Wikitude SDK debugging */

#import <WikitudeSDK/WTArchitectViewDebugDelegate.h>

 

 

 

@interface ViewController () <WTArchitectViewDelegate, WTArchitectViewDebugDelegate>

 

/* Add a strong property to the main Wikitude SDK component, the WTArchitectView */

@property (nonatomic, strong) WTArchitectView               *architectView;

 

/* And keep a weak property to the navigation object which represents the loading status of your Architect World */

@property (nonatomic, weak) WTNavigation                    *architectWorldNavigation;

 

@end

 

@implementation ViewController

 

- (void)dealloc

{

    /* Remove this view controller from the default Notification Center so that it can be released properly */

    [[NSNotificationCenter defaultCenter] removeObserver:self];

 

}

 

- (void)viewDidLoad {

    [super viewDidLoad];

    // Do any additional setup after loading the view, typically from a nib.

    

    /* It might be the case that the device which is running the application does not fulfil all Wikitude SDK hardware requirements.

     To check for this and handle the situation properly, use the -isDeviceSupportedForRequiredFeatures:error class method.

     

     Required features specify in more detail what your Architect World intends to do. Depending on your intentions, more or less devices might be supported.

     e.g. an iPod Touch is missing some hardware components so that Geo augmented reality does not work, but 2D tracking does.

     

     NOTE: On iOS, an unsupported device might be an iPhone 3GS for image recognition or an iPod Touch 4th generation for Geo augmented reality.

     */

    NSError *deviceSupportError = nil;

    if ( [WTArchitectView isDeviceSupportedForRequiredFeatures:WTFeature_2DTracking error:&deviceSupportError] ) {

        

        /* Standard WTArchitectView object creation and initial configuration */

        self.architectView = [[WTArchitectView alloc] initWithFrame:CGRectZero motionManager:nil];

        self.architectView.delegate = self;

        self.architectView.debugDelegate = self;

        

        /* Use the -setLicenseKey method to unlock all Wikitude SDK features that you bought with your license. */

        [self.architectView setLicenseKey:@"NGBXvYi66YY4pT3CqeLvcv31N9xl4uasQSZwF5xPfJ5lcrI5leTkRrzzVihYTbEbRWRf9S9hWqkeCykxd1IgU/qbg5WJjwSK7dk9f/zHwlV1Qa/JYIB6l+sh2OjrdrXO7E9Qdqih1RYGF+3MDt7CC3BmMUrhkFanOvCf/eXMmX1TYWx0ZWRfX6PikQ4qQBjn7mRR7l4e36y3jrIqcuQfE4vdeKCDiD2pePwQ41U/FnA7HSShjqq9TcTpQaASuWQL+nnrKUU3ybpck+50zKokc0nK6tX0rjqAE3cKZJIXMV1VRszX2rUJFFzM80eMWNQ2FN6I3e0LlyY3gkAt05XUiTq4YaOVb62gRlytIPNvaxwFoj3Xvh5+vR4afdbKAgdAlxT4KLazRObTUBuYHWeKU9/cXR4RagzSDUt+mpYzEVpZTB8OjGFWKf+j+5kCRrQ/ra4gYIuf3KqYFy0JsuAeN2keaI5M34saqcTNSUV7Ng1V/ZjJg9Ac56TLC+D1FuMDdpZ6c3eWTsaccwc4tMmnyiA8Y60GqXIeFOClE1locWR0Fu/MXmOkoFSXGy/ldfzVOo756Mhb4xCSTvbN+PUKbyM9EYWrmj3Yu88wxglud9L+G8etmi+Mr1wO4SGCfIQdzu1Pt9go8QhZpIB7Nyk1IirWW99b10Kzh8rW1fj8ReVBddHb4SU5+r2/CmAUMrbohodJFBefpbagBhQ7EV8sg/1ylBYaNVXUi3bfCt437rcwNniWV6/Pm4thryejMMflAji9gp+TgioY4r1ex6LDzzzRrHGZ+Qypwrm41oxWpz5Gw4hbkeakbqhVT7AgTq2bvQ++Gkksaw5RO54rIzuh2QOu1Ad+XY81VHLYMnudcLzWuY3WcrQEqgQ/jRIGOH4ZywKTOqtXozF4Us85z5CWHfdESc2foe68ZbOem/pn7a9Hk+foWy9oFp8/0lEKjoVCZp264eeU7EsdQoHNnPDq8w3UZSfVGd3sOytAIQAkeFER/5GNQBXM+gsoCU3cd5Wrfvj9LHrC223CqdDENpyVc2uHc+RfyOAhXMZxtw0+Hi2etkJXkC+6y4ncxwKt8wlThhBtpDfgE0wB6wZ0sHLE+fmK7LOSUipj8qc7s6sD01la+xHL7yrcpWDJIJ46cgiycaVb7AWSW5c8wXpKK+i/JgI8IDVDPqMFZVfhFhfW8jg="];

        

        /* The Architect World can be loaded independently from the WTArchitectView rendering.

         

         NOTE: The architectWorldNavigation property is assigned at this point. The navigation object is valid until another Architect World is loaded.

         */

        self.architectWorldNavigation = [self.architectView loadArchitectWorldFromURL:[[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html" subdirectory:@"views/ar"] withRequiredFeatures:WTFeature_2DTracking];

        

        /* Because the WTArchitectView does some OpenGL rendering, frame updates have to be suspended and resumend when the application changes it's active state.

         Here, UIApplication notifications are used to respond to the active state changes.

         

         NOTE: Since the application will resign active even when an UIAlert is shown, some special handling is implemented in the UIApplicationDidBecomeActiveNotification.

         */

        [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidBecomeActiveNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {

            

            /* When the application starts for the first time, several UIAlert's might be shown to ask the user for camera and/or GPS access.

             Because the WTArchitectView is paused when the application resigns active (See line 86), also Architect JavaScript evaluation is interrupted.

             To resume properly from the inactive state, the Architect World has to be reloaded if and only if an active Architect World load request was active at the time the application resigned active.

             This loading state/interruption can be detected using the navigation object that was returned from the -loadArchitectWorldFromURL:withRequiredFeatures method.

             */

            if (self.architectWorldNavigation.wasInterrupted) {

                [self.architectView reloadArchitectWorld];

            }

            

            /* Standard WTArchitectView rendering resuming after the application becomes active again */

            [self startWikitudeSDKRendering];

        }];

        [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillResignActiveNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {

            

            /* Standard WTArchitectView rendering suspension when the application resignes active */

            [self stopWikitudeSDKRendering];

        }];

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveApplicationWillResignActiveNotification:) name:UIApplicationWillResignActiveNotification object:nil];

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveApplicationDidBecomeActiveNotification:) name:UIApplicationDidBecomeActiveNotification object:nil];

        

        /* Standard subview handling using Autolayout */

        //[self.view addSubview:self.architectView];

        [self.view insertSubview:self.architectView atIndex:0];

        

        self.architectView.translatesAutoresizingMaskIntoConstraints = NO;

        

        NSDictionary *views = NSDictionaryOfVariableBindings(_architectView);

        [self.view addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"|[_architectView]|" options:0 metrics:nil views:views] ];

        [self.view addConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_architectView]|" options:0 metrics:nil views:views] ];

    }

    else {

        NSLog(@"This device is not supported. Show either an alert or use this class method even before presenting the view controller that manages the WTArchitectView. Error: %@", [deviceSupportError localizedDescription]);

    }

}

 

#pragma mark - View Lifecycle

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    //[self.view insertSubview:self.architectView atIndex:0];

    /* WTArchitectView rendering is started once the view controllers view will appear */

    [self startWikitudeSDKRendering];

}

 

- (void)viewDidDisappear:(BOOL)animated {

    [super viewDidDisappear:animated];

    

    /* WTArchitectView rendering is stopped once the view controllers view did disappear */

    [self stopWikitudeSDKRendering];

}

 

- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}

 

#pragma mark - View Rotation

- (BOOL)shouldAutorotate {

    

    return YES;

}

 

 

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

    

    /* When the device orientation changes, specify if the WTArchitectView object should rotate as well */

    [self.architectView setShouldRotate:YES toInterfaceOrientation:toInterfaceOrientation];

}

 

#pragma mark - Private Methods

 

/* Convenience methods to manage WTArchitectView rendering. */

- (void)startWikitudeSDKRendering{

    

    /* To check if the WTArchitectView is currently rendering, the isRunning property can be used */

    if ( ![self.architectView isRunning] ) {

        

        /* To start WTArchitectView rendering and control the startup phase, the -start:completion method can be used */

        [self.architectView start:^(WTStartupConfiguration *configuration) {

            

            /* Use the configuration object to take control about the WTArchitectView startup phase */

            /* You can e.g. start with an active front camera instead of the default back camera */

            

            // configuration.captureDevicePosition = AVCaptureDevicePositionFront;

            

        } completion:^(BOOL isRunning, NSError *error) {

            

            /* The completion block is called right after the internal start method returns.

             

             NOTE: In case some requirements are not given, the WTArchitectView might not be started and returns NO for isRunning.

             To determine what caused the problem, the localized error description can be used.

             */

            if ( !isRunning ) {

                NSLog(@"WTArchitectView could not be started. Reason: %@", [error localizedDescription]);

            }

        }];

    }

}

 

- (void)stopWikitudeSDKRendering {

    

    /* The stop method is blocking until the rendering and camera access is stopped */

    if ( [self.architectView isRunning] ) {

        [self.architectView stop];

    }

}

 

 

#pragma mark - Notifications

/* UIApplication specific notifications are used to pause/resume the architect view rendering */

- (void)didReceiveApplicationWillResignActiveNotification:(NSNotification *)notification

{

    [self stopWikitudeSDKRendering ];

}

 

- (void)didReceiveApplicationDidBecomeActiveNotification:(NSNotification *)notification

{

    if ( self.architectWorldNavigation.wasInterrupted )

    {

        [self.architectView reloadArchitectWorld];

    }

    [self startWikitudeSDKRendering ];

}

 

 

 

/* The WTArchitectView provides two delegates to interact with. */

#pragma mark - Delegation

 

/* The standard delegate can be used to get information about:

 * The Architect World loading progress

 * architectsdk:// protocol invocations using document.location inside JavaScript

 * Managing view capturing

 * Customizing view controller presentation that is triggered from the WTArchitectView

 */

#pragma mark WTArchitectViewDelegate

- (void)architectView:(WTArchitectView *)architectView didFinishLoadArchitectWorldNavigation:(WTNavigation *)navigation {

    /* Architect World did finish loading */

}

 

- (void)architectView:(WTArchitectView *)architectView didFailToLoadArchitectWorldNavigation:(WTNavigation *)navigation withError:(NSError *)error {

    

    NSLog(@"Architect World from URL '%@' could not be loaded. Reason: %@", navigation.originalURL, [error localizedDescription]);

}

 

/* The debug delegate can be used to respond to internal issues, e.g. the user declined camera or GPS access.

 

 NOTE: The debug delegate method -architectView:didEncounterInternalWarning is currently not used.

 */

#pragma mark WTArchitectViewDebugDelegate

- (void)architectView:(WTArchitectView *)architectView didEncounterInternalWarning:(WTWarning *)warning {

    

    /* Intentionally Left Blank */

}

 

- (void)architectView:(WTArchitectView *)architectView didEncounterInternalError:(NSError *)error {

    

    NSLog(@"WTArchitectView encountered an internal error '%@'", [error localizedDescription]);

}

 

 

- (IBAction)backbutton:(id)sender {

    [self.architectView clearCache];

    [self stopWikitudeSDKRendering];

}

@end

 

 

if you can help me !!!! because i 'ont understand the problem


RE: memory architectview IOS
Answer
11/8/16 9:26 AM as a reply to ced fry.

Hi ced,
Can you make sure that you use the latest version of our SDK (5.3.0)? The log message you mentiond should not show up there anymore.

Might it be that your view controller never get's deallocated? Can you please add some log messages to your view controllers -dealloc methods to see if they are actually destroyed when you navigate around inside your app.

You can also have a look at our example application on how to manage view controller transitions.

Best regards,
Andreas

RE: memory architectview IOS
Answer
11/8/16 11:38 AM as a reply to Andreas Schacherbauer.

Hi andreas , i use your code but i d'ont understand where i can dealloc architectview with a back button... i have simply use your code ...

 


RE: memory architectview IOS
Answer
11/9/16 7:29 AM as a reply to ced fry.

Hi ced,
I meant a log in your view controllers dealloc method. You already have a dealloc method declared, simply add a NSLog there.

Best regards,
Andreas