0

我刚刚被苹果拒绝,原因如下:

我们无法审核您的应用程序,因为它在以下设备上启动时崩溃: - 运行 iOS 8.1 的 iPhone 5S- 运行 iOS 8.1 的 iPhone 6- 运行 iOS 8.1 的 iPhone 6 Plus

这是我所做的:

我确实使用模拟器 ios 8.1、8.2 中的设备对其进行了测试。我还使用读取设备对其进行了测试:运行 ios 7.1 的 iphone 4,运行 ios 8.3 的 ipad。根本没有崩溃。

使用他们发送的崩溃日志,我使用Symbolicator生成以下符号化日志:

Process:             Meety [1125]
Path:                /private/var/mobile/Containers/Bundle/Application/12CA9A59-184C-4B7E-9D2A-0B4703363AA2/Meety.app/Meety
Identifier:          com.cungcode.Meety
Version:             1 (1.0)
Code Type:           ARM-64 (Native)
Parent Process:      launchd.development [1]

Date/Time:           2015-05-16 05:34:46.952 -0700
Launch Time:         2015-05-16 05:34:46.165 -0700
OS Version:          iOS 8.1 (12B411)
UDID:                d1c1574d0e021ab0d30ce26e69978227c7080d3c
Report Version:      105

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000010016bdf8
Triggered by Thread:  0

Filtered syslog:
2015-05-16 05:34:46.535 Meety[1125]: <Error> assertion failed: 12B411: libxpc.dylib + 71820 [AD580443-238D-3997-8D09-004C210D0C18]: 0x7d

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
__TFC5Meety20MainTabBarController24addCenterButtonWithImagefS0_FTCSo7UIImage14highlightImageGSqS1___T_ MainTabBarController.swift:227
__TFC5Meety20MainTabBarController11viewDidLoadfS0_FT_T_ MainTabBarController.swift:57
2   UIKit                           0x000000018a72ce80 0x18a71c000 + 69248
3   UIKit                           0x000000018a72cb90 0x18a71c000 + 68496
4   UIKit                           0x000000018a733258 0x18a71c000 + 94808
5   UIKit                           0x000000018a7309d8 0x18a71c000 + 84440
6   UIKit                           0x000000018a7a1a00 0x18a71c000 + 547328
7   UIKit                           0x000000018a9b5434 0x18a71c000 + 2724916
8   UIKit                           0x000000018a9b79ac 0x18a71c000 + 2734508
9   UIKit                           0x000000018a9b6044 0x18a71c000 + 2728004
10  FrontBoardServices              0x000000018e2c163c 0x18e2a8000 + 103996
11  CoreFoundation                  0x0000000185f36120 0x185e58000 + 909600
12  CoreFoundation                  0x0000000185f35228 0x185e58000 + 905768
13  CoreFoundation                  0x0000000185f3384c 0x185e58000 + 899148
14  CoreFoundation                  0x0000000185e611f0 0x185e58000 + 37360
15  UIKit                           0x000000018a797788 0x18a71c000 + 505736
16  UIKit                           0x000000018a792780 0x18a71c000 + 485248
_main AppDelegate.swift:16
18  libdyld.dylib                   0x0000000196dc6a04 0x196dc4000 + 10756

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x0000000196ec4c94 0x196ec4000 + 3220
1   libdispatch.dylib               0x0000000196dac97c 0x196d9c000 + 67964
2   libdispatch.dylib               0x0000000196d9f3b0 0x196d9c000 + 13232

Thread 2:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 3:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 4:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 5:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 6:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 7:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 8:
0   libsystem_kernel.dylib          0x0000000196edfc78 0x196ec4000 + 113784
1   libsystem_pthread.dylib         0x0000000196f79390 0x196f78000 + 5008
2   libsystem_pthread.dylib         0x0000000196f78fa4 0x196f78000 + 4004

Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000196f71958   x2: 0x000000015fd233e0   x3: 0x000000000000001e
    x4: 0x0000000000000010   x5: 0x0000000000000001   x6: 0x0000000000000000   x7: 0x0000000000000000
    x8: 0x0000000000000000   x9: 0x000000015fe0c850  x10: 0x0000000000000000  x11: 0x000000000000005e
   x12: 0x0000000000000001  x13: 0x000000000017a17c  x14: 0x0000000000000015  x15: 0x0000000000000000
   x16: 0x0000000100a8217c  x17: 0x0000000000000000  x18: 0x0000000000000000  x19: 0x00000001740995a0
   x20: 0x00000001700997d0  x21: 0x000000015fe0c850  x22: 0x0000000000000000  x23: 0x000000015fd233e0
   x24: 0x0000000100ab30c8  x25: 0x0000000100856dd0  x26: 0x0000000100856dd0  x27: 0x000000019aa4a0a8
   x28: 0x0000000000000001  fp: 0x000000016fd1e160   lr: 0x000000010016b8c0
    sp: 0x000000016fd1e100   pc: 0x000000010016bdf8 cpsr: 0x80000000

所以在我看来,错误必须在以下代码中:

(在 MainTabBarController 中)

@IBOutlet weak var mapButton: UIButton!

override func viewDidLoad()
{

    super.viewDidLoad()
    self.delegate = self
    var middleImage:UIImage = UIImage(named:"MapButton")!
    var highlightedMiddleImage:UIImage = UIImage(named:"MapButtonHighlighted")!
    addCenterButtonWithImage(middleImage, highlightImage: highlightedMiddleImage) //Line 57 --> Correct!!
    self.tabBar.barTintColor = UIColor.blackColor()

}

func addCenterButtonWithImage(buttonImage: UIImage, highlightImage:UIImage?)
{
    mapButton = UIButton.buttonWithType(UIButtonType.Custom) as UIButton //UPDATE 1: LINE 206 --> CRASH HERE 
    mapButton.autoresizingMask = UIViewAutoresizing.FlexibleBottomMargin|UIViewAutoresizing.FlexibleLeftMargin|UIViewAutoresizing.FlexibleRightMargin|UIViewAutoresizing.FlexibleTopMargin

    mapButton.frame = CGRectMake(0.0, 0.0, buttonImage.size.width, buttonImage.size.height);
    mapButton.setBackgroundImage(buttonImage, forState: UIControlState.Normal)
    mapButton.setBackgroundImage(highlightImage, forState: UIControlState.Highlighted)
    //Center the button on tabbar        
    var heightDifference:CGFloat = buttonImage.size.height - self.tabBar.frame.size.height;

    if heightDifference < 0 {
        mapButton.center = self.tabBar.center;
    }
    else
    {
        var center:CGPoint = self.tabBar.center;
        center.y = center.y - heightDifference/2.0;
        mapButton.center = center;
    }

    mapButton.addTarget(self, action: "changeSelectedTabToMapTabController:", forControlEvents: UIControlEvents.TouchUpInside)

    self.view.addSubview(mapButton)
} //LINE 227: PROBABLY CRASH HERE, BUT I THINK IT CRASH ON LINE 206

上面代码的意思是,我想创建一个类似 Instagram 的标签栏。因此,我在 5 项选项卡栏中的 3 选项卡前面添加了一个按钮。在模拟器 ios 8.1 中,它如下所示:

在此处输入图像描述

1)代码很简单,我不知道为什么它在 ios 8.1 中崩溃。现在我没有运行 ios 8.1 的真实设备来测试它,所以我问你是否可以在代码中找到异常的东西。

2) 应用程序是否有可能因为配置文件有问题而崩溃?但我认为这不是我的情况,因为我使用分发配置文件存档,并通过 iTunes 和 TestFlight 将 ipa 安装到我的 ipad 上,它可以正常运行。

对不起,很长的问题。任何帮助将非常感激!

更新 1:我通过命令行再次确认崩溃,正如西藏海岸的回答在这里所描述的那样。然后我得到崩溃必须在代码的第 206 行:

mapButton = UIButton.buttonWithType(UIButtonType.Custom) as UIButton

这种启蒙一定有问题。我没有为这个按钮使用 Storyboard,但我以编程方式创建。我使用 XCode 6.3(我正在使用 6.2)的朋友,在打开我的项目时看到很多与“as”、“!”相关的编译错误。和 ”?”。我想我要把我的 XCode 更新到 6.3,看看我在第 206 行是否有“as”的编译错误。

4

2 回答 2

1

只需通过在 Edit Scheme 中将构建配置设置为Release for Run选项卡来检查应用程序的运行情况,看看崩溃是否仍然发生,它将帮助您进行调试,因为构建在发布模式下崩溃。我觉得这主要是一个 swift 编译器问题,如果是这样,您可以通过将 swift 编译器优化从最快更改为无来避免它。我不确定这是否是一个理想的解决方案,但看看这是否有帮助。:]

于 2015-05-20T08:41:36.910 回答
0

最后,我设法得到了一个真正的设备进行测试。它在以下行崩溃:

mapButton.autoresizingMask = UIViewAutoresizing.FlexibleBottomMargin|UIViewAutoresizing.FlexibleLeftMargin|UIViewAutoresizing.FlexibleRightMargin|UIViewAutoresizing.FlexibleTopMargin

原因:mapButton 为 nil。这很奇怪,因为这条线就在上面:

mapButton = UIButton.buttonWithType(UIButtonType.Custom) as UIButton

所以面对这个初始化程序不要初始化我的按钮。所以我可能同意 Chandan005 关于编译器问题的看法。我将代码更改为:

   let frame = CGRectMake(0.0, 0.0, buttonImage.size.width, buttonImage.size.height)
    button = UIButton(frame: frame)

现在它可以在 iPhone 6、ios 8.1 上运行。我已经再次提交了我的应用程序,希望它会通过这次。我在我的博客中写过这个错误。

于 2015-05-21T08:47:33.403 回答