Giter Site home page Giter Site logo

testtximsdk's Introduction

测试TIMSDK内存泄漏

会发生内存泄漏的机型:iPhone 7P(iOS 13.2.3)

不发生内存泄漏的机型:iPhone 5(iOS 10.1.1)

1. 开发环境

TXIMSDK_iOS为最新版本:4.9.1

手机为:iPhone 7P,iOS版本为13.2.3

2. 重现步骤

  1. 运行项目,进入首页
  2. 点击“下一页”,在下一个界面,初始化SDK,然后返回上一页。发生内存泄漏

内存泄漏截图

3. 相关代码

#import "DetailViewController.h"
#import <ImSDK/ImSDK.h>

@interface DetailViewController () <V2TIMSDKListener>
@property (nonatomic, assign) BOOL didInitSDK;
@end

@implementation DetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addButtonsWithTitles:@[@"返回", @"初始化SDK", @"释放SDK"]];
}

- (void)actionButtonClick:(UIButton *)sender action:(NSString *)action {
    if ([action isEqualToString:@"返回"]) {
        [self closeViewController:YES];
    } else if ([action isEqualToString:@"初始化SDK"]) {
        if (!self.didInitSDK) {
            V2TIMSDKConfig *config = [[V2TIMSDKConfig alloc] init];
            config.logLevel = V2TIM_LOG_DEBUG;

            BOOL ret = [[V2TIMManager sharedInstance] initSDK:111111 config:config listener:self];
            NSLog(@"初始化结果:%d", ret);

            self.didInitSDK = YES;
        }
    } else if ([action isEqualToString:@"释放SDK"]) {
        if (self.didInitSDK) {
            [[V2TIMManager sharedInstance] unInitSDK];
            self.didInitSDK = NO;
        }
    }
}

// 返回上一页
- (void)closeViewController:(BOOL)animated {
    if (self.didInitSDK) {
        [[V2TIMManager sharedInstance] unInitSDK];
        self.didInitSDK = NO;
    }
    [super closeViewController:animated];
}

testtximsdk's People

Contributors

andney avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.