加载空的笔尖导致appstore审查崩溃

时间:2013-06-08 08:06:50

标签: ios ipad nib crash-reports

Apple在加载仅包含视图和背景颜色的笔尖时设法让我的应用程序崩溃。我似乎无法在我的设备上崩溃。这可能是一个内存问题,还是我在代码中做了些蠢事?报告和代码如下:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x32b0629e __exceptionPreprocess + 158
1   libobjc.A.dylib                 0x3a9aa97a objc_exception_throw + 26
2   CoreFoundation                  0x32b061c0 +[NSException raise:format:] + 100
3   UIKit                           0x34aab56c -[UINib instantiateWithOwner:options:] + 1632
4   UIKit                           0x34aaab96 -[UIViewController _loadViewFromNibNamed:bundle:] + 230
5   UIKit                           0x349a3038 -[UIViewController loadView] + 88
6   UIKit                           0x3492d468 -[UIViewController loadViewIfRequired] + 64
7   CodeFriend                      0x000b3b14 -[ThemesPopOverViewController initWithNibName:bundle:] (ThemesPopOverViewController.m:24)
8   CodeFriend                      0x000b221a -[AppDelegate settingAct:] (AppDelegate.m:127)

我在viewcontroller中使用的代码:

#import "ThemesPopOverViewController.h"

@interface ThemesPopOverViewController ()

@end

@implementation ThemesPopOverViewController
@synthesize tableView;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {


        themes = [[NSArray alloc] initWithObjects:kRegexHighlightViewThemeArray];
        self.tableView = nil;
        self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(20, 0, self.view.frame.size.width - 40, 350)];
        [self.tableView setBackgroundColor:[UIColor clearColor]];
        [self.tableView setDelegate:self];
        [self.tableView setDataSource:self];
        [self.view addSubview:self.tableView];
        int item = [themes indexOfObject:theDelegate.codeView.currentTheme];
        NSIndexPath *indexPath = [NSIndexPath indexPathForItem:item inSection:0];
        [self.tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];

    }

    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;    //count of section
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    //NSLog(@"%d",themes.count);
    return [themes  count];    //count number of row from counting array hear cataGorry is An Array
}



- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *MyIdentifier = @"MyIdentifier";

    UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:MyIdentifier];

    if (cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
                                      reuseIdentifier:MyIdentifier];

        UIView *bgColorView = [[UIView alloc] init];
        [bgColorView setBackgroundColor:[UIColor colorWithRed:25/255.0f green:185/255.0f blue:152/255.0f alpha:1.0f]];
        [cell setSelectedBackgroundView:bgColorView];
    }
    [cell.textLabel setFont:[UIFont fontWithName:@"Helvetica" size:16]];
    cell.textLabel.text = [themes objectAtIndex: indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSLog(@"%d", indexPath.row);
    [theDelegate.codeView setHighlightThemeFromString:[themes objectAtIndex:indexPath.row]];
    [theDelegate removePop];

}

@end

H档案:

#import <UIKit/UIKit.h>
#import "AppDelegate.h"


@interface ThemesPopOverViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>{
    NSArray *themes;
}
@property (nonatomic, retain) UITableView *tableView;





@end

笔尖:

<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
    <data>
        <int key="IBDocument.SystemTarget">1552</int>
        <string key="IBDocument.SystemVersion">12D78</string>
        <string key="IBDocument.InterfaceBuilderVersion">3084</string>
        <string key="IBDocument.AppKitVersion">1187.37</string>
        <string key="IBDocument.HIToolboxVersion">626.00</string>
        <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
            <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
            <string key="NS.object.0">2083</string>
        </object>
        <array key="IBDocument.IntegratedClassDependencies">
            <string>IBProxyObject</string>
            <string>IBUIView</string>
        </array>
        <array key="IBDocument.PluginDependencies">
            <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
        </array>
        <object class="NSMutableDictionary" key="IBDocument.Metadata">
            <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
            <integer value="1" key="NS.object.0"/>
        </object>
        <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
            <object class="IBProxyObject" id="372490531">
                <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
                <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
            </object>
            <object class="IBProxyObject" id="975951072">
                <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
                <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
            </object>
            <object class="IBUIView" id="191373211">
                <reference key="NSNextResponder"/>
                <int key="NSvFlags">274</int>
                <string key="NSFrame">{{0, 20}, {128, 214}}</string>
                <reference key="NSSuperview"/>
                <object class="NSColor" key="IBUIBackgroundColor">
                    <int key="NSColorSpace">2</int>
                    <bytes key="NSRGB">MC4yNTg4MjM1NDM4IDAuMzYwNzg0MzIyIDAuNDI3NDUxMDE0NQA</bytes>
                </object>
                <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
                <object class="IBUISimulatedSizeMetrics" key="IBUISimulatedDestinationMetrics">
                    <string key="IBUISimulatedSizeMetricsClass">IBUISimulatedFreeformSizeMetricsSentinel</string>
                    <string key="IBUIDisplayName">Freeform</string>
                </object>
                <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
            </object>
        </array>
        <object class="IBObjectContainer" key="IBDocument.Objects">
            <array class="NSMutableArray" key="connectionRecords">
                <object class="IBConnectionRecord">
                    <object class="IBCocoaTouchOutletConnection" key="connection">
                        <string key="label">view</string>
                        <reference key="source" ref="372490531"/>
                        <reference key="destination" ref="191373211"/>
                    </object>
                    <int key="connectionID">3</int>
                </object>
            </array>
            <object class="IBMutableOrderedSet" key="objectRecords">
                <array key="orderedObjects">
                    <object class="IBObjectRecord">
                        <int key="objectID">0</int>
                        <array key="object" id="0"/>
                        <reference key="children" ref="1000"/>
                        <nil key="parent"/>
                    </object>
                    <object class="IBObjectRecord">
                        <int key="objectID">1</int>
                        <reference key="object" ref="191373211"/>
                        <reference key="parent" ref="0"/>
                    </object>
                    <object class="IBObjectRecord">
                        <int key="objectID">-1</int>
                        <reference key="object" ref="372490531"/>
                        <reference key="parent" ref="0"/>
                        <string key="objectName">File's Owner</string>
                    </object>
                    <object class="IBObjectRecord">
                        <int key="objectID">-2</int>
                        <reference key="object" ref="975951072"/>
                        <reference key="parent" ref="0"/>
                    </object>
                </array>
            </object>
            <dictionary class="NSMutableDictionary" key="flattenedProperties">
                <string key="-1.CustomClassName">ThemesPopOverViewController</string>
                <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                <string key="-2.CustomClassName">UIResponder</string>
                <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
            </dictionary>
            <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
            <nil key="activeLocalization"/>
            <dictionary class="NSMutableDictionary" key="localizations"/>
            <nil key="sourceID"/>
            <int key="maxID">3</int>
        </object>
        <object class="IBClassDescriber" key="IBDocument.Classes"/>
        <int key="IBDocument.localizationMode">0</int>
        <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
        <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
        <int key="IBDocument.defaultPropertyAccessControl">3</int>
        <bool key="IBDocument.UseAutolayout">YES</bool>
        <string key="IBCocoaTouchPluginVersion">2083</string>
    </data>
</archive>

2 个答案:

答案 0 :(得分:1)

我认为你有iOS部署目标&lt; 6.0并且您不会关闭自动布局。 转到View-&gt; Utilites-&gt; Show File Inspector并取消选中“Use Autolayout”选项。

enter image description here

答案 1 :(得分:0)

在另一台计算机上加载项目显示错误,在整个过程中某些重构已完成,只有代码中的nib名称未更新。因此,以某种方式缓存,xcode 使用旧笔尖。然而,在档案中,这些笔尖不存在,因此崩溃。我应该试着清理这个项目!并查看了更多的代码!