iOS应用程序在分发配置文件中崩溃

时间:2015-10-08 14:44:02

标签: ios iphone provisioning-profile

我是iOS开发的新手,我开发了一个使用我的开发配置文件工作正常的应用程序(没有任何单个崩溃或错误)。当我尝试使用分发配置文件存档我的应​​用程序并运行时,一个特定的方法崩溃,但我仔细检查,它在开发配置文件中工作正常。注意 - 我使用相同的设备并检查它与开发和分发配置文件。

以下是从设备生成的日志

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

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   ServiceAnytime                  0x0017e080 0x9b000 + 929920
1   ServiceAnytime                  0x00176888 0x9b000 + 899208
2   UIKit                           0x25437dd6 0x253f7000 + 265686
3   UIKit                           0x2559b37c 0x253f7000 + 1721212
4   UIKit                           0x25437dd6 0x253f7000 + 265686
5   UIKit                           0x25437d7c 0x253f7000 + 265596
6   UIKit                           0x2542296e 0x253f7000 + 178542
7   UIKit                           0x254377e8 0x253f7000 + 264168
8   UIKit                           0x254374c2 0x253f7000 + 263362
9   UIKit                           0x25430d9c 0x253f7000 + 236956
10  UIKit                           0x25406f90 0x253f7000 + 65424
11  UIKit                           0x2567d8a6 0x253f7000 + 2648230
12  UIKit                           0x254059a4 0x253f7000 + 59812
13  CoreFoundation                  0x21d4ffac 0x21c82000 + 843692
14  CoreFoundation                  0x21d4f3ba 0x21c82000 + 840634
15  CoreFoundation                  0x21d4da20 0x21c82000 + 834080
16  CoreFoundation                  0x21c9a1fc 0x21c82000 + 98812
17  CoreFoundation                  0x21c9a00e 0x21c82000 + 98318
18  GraphicsServices                0x2976b1fc 0x29762000 + 37372
19  UIKit                           0x25466a04 0x253f7000 + 457220
20  ServiceAnytime                  0x001257d0 0x9b000 + 567248
21  libdyld.dylib                   0x309dfaac 0x309de000 + 6828

我无法理解或解决问题,如果有人有解决方案,请在此处发布

以下是导致崩溃的代码

 @IBAction func actionSubscribeTicket(sender: AnyObject) {

        var loadingview : UIView = LoadingView().

    addLoadingView()
            view.addSubview(loadingview)

            var authorizationToken : String  = (MyKeychainWrapper.myObjectForKey("v_Data") as? String)!;

            var loggedUserId : String = 

(NSUserDefaults.standardUserDefaults().valueForKey("loggedUserLoginUserName") as! NSString) as String;
        var deviceToken : String = "";

        if UIDevice.currentDevice().model == "iPhone Simulator" {
             deviceToken  = "123";
        }else{
            deviceToken = (NSUserDefaults.standardUserDefaults().valueForKey("deviceToken")) as! String;
        }

        manager.requestSerializer.setValue("application/json", forHTTPHeaderField: "Content-Type")

        manager.requestSerializer = AFJSONRequestSerializer(writingOptions: nil);

        manager.requestSerializer.setValue(MyKeychainWrapper.myObjectForKey("v_Data") as? String, forHTTPHeaderField: "Authorization")

        var parameters : NSDictionary;
        var url : String = "";

        if(isSubscribed){
            //url = ProjectProperties.url.unsubscribeService
            parameters = ["userId" : loggedUserId, "ticketId" : ticketRefNo  , "deviceToken" :  deviceToken ];

            manager.DELETE(ProjectProperties.url.unsubscribeService + ticketRefNo,
                parameters: parameters,
                success: { (operation: AFHTTPRequestOperation!,responseObject: AnyObject!) in
                    println(responseObject.description)
                    loadingview.removeFromSuperview();


                    let alertController = UIAlertController(title: "", message:
                        "UnSubscription Sucessful", preferredStyle: UIAlertControllerStyle.Alert)
                    alertController.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default,handler: nil))
                    self.presentViewController(alertController, animated: true, completion: nil)

                    self.isSubscribed = false;
                    self.subscribeBarButtin.image = self.subscribedImage;
                },
                failure: { (operation: AFHTTPRequestOperation!,error: NSError!) in
                    println("Error: " + error.localizedDescription)

                    let alertController = UIAlertController(title: "", message:
                        "Error: " + error.localizedDescription, preferredStyle: UIAlertControllerStyle.Alert)
                    alertController.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default,handler: nil))
                    self.presentViewController(alertController, animated: true, completion: nil)

                    loadingview.removeFromSuperview();
            })

        }else{

            //url = ProjectProperties.url.subscribeService
            parameters = [/*"userId" : loggedUserId,*/ "ticketId" : ticketRefNo  , "deviceToken" :  deviceToken ,  "gateway" :  "apns"];


            println(ProjectProperties.url.subscribeService);

            manager.POST(ProjectProperties.url.subscribeService,
                parameters: parameters,
                success: { (operation: AFHTTPRequestOperation!,responseObject: AnyObject!) in

                    println(responseObject.description)

                    let alertController = UIAlertController(title: "", message:
                        "Subscription Sucessful", preferredStyle: UIAlertControllerStyle.Alert)
                    alertController.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default,handler: nil))
                    self.presentViewController(alertController, animated: true, completion: nil)

                    loadingview.removeFromSuperview();
                    self.isSubscribed = true;
                    self.subscribeBarButtin.image = self.unsubscribedImage;
                    //self.navigationController?.popViewControllerAnimated(true);
                },
                failure: { (operation: AFHTTPRequestOperation!,error: NSError!) in
                    println("Error: " + error.localizedDescription)
                    let alertController = UIAlertController(title: "", message:
                        "Error: " + error.localizedDescription, preferredStyle: UIAlertControllerStyle.Alert)
                    alertController.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default,handler: nil))

                    loadingview.removeFromSuperview();
            })
        }
    }

提前致谢

0 个答案:

没有答案