小编McG*_*ter的帖子

iOS词典导致内存泄漏

为什么下面的Dictionary实现会导致内存泄漏?请参阅下面的屏幕截图.几乎所有泄漏都来自这种方法.

- (void) setLocation:(NSString *) location:(NSString *) turnPage {
    NSLog(@"Start setLocation");
    //---get the path to the property list file---
    NSString *localPlistFileNameConf = [[self documentsPath] stringByAppendingPathComponent:@"Config.plist"];
    NSMutableDictionary *copyOfDict;
    //---if the property list file can be found---
    if ([[NSFileManager defaultManager] fileExistsAtPath:localPlistFileNameConf]) {
        //---load the content of the property list file into a NSDictionary object---
        NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:localPlistFileNameConf];
        //---make a mutable copy of the dictionary object---
        copyOfDict = [dict mutableCopy];
        [dict release];
    }
    else {
        //---load the property list from …
Run Code Online (Sandbox Code Playgroud)

memory-leaks ios

1
推荐指数
1
解决办法
570
查看次数

iOS调用另一个类的方法

我在这个网站上发现了类似的问题,但没有一个以明确和基本的方式解决问题的问题.

我有我的ReadViewController.h和ReadViewController.m文件以及我的ChooseViewController.h和ChooseViewController.m文件.

他们都需要访问当前在ReadViewController.m文件中的getProperties方法.

- (void) getProperties {
    NSLog(@"Start getProperties");
//SOME CODE
    NSLog(@"End getProperties");
}
Run Code Online (Sandbox Code Playgroud)

理想情况下,这将在名为GeneralModel.m的第三个文件中

请给我一个基本示例,说明控制器文件中需要哪些代码才能调用此方法.

methods class ios

0
推荐指数
1
解决办法
9573
查看次数

标签 统计

ios ×2

class ×1

memory-leaks ×1

methods ×1