2013-11-26 71 views
0

我上傳了appstore.its上的應用程序,可以正常使用io6,但是當我上傳到蘋果商店時,由於iOS7中的應用程序崩潰而被拒絕。當我運行它時在xcode 4.5上它的工作正常,我得到了購買alertview消息,但我無法得到它在xcode5和ios7.here這是我的源代碼。應用程序內購買二進制文件因iOS7中的應用程序崩潰而被拒絕

- (IBAction)buy { 
      activityIndicator.hidden = NO; 

      SKMutablePayment *payment = [[[SKMutablePayment alloc] init] autorelease]; 
     payment.productIdentifier = @"com.test.app.V3"; 
     [[SKPaymentQueue defaultQueue] addTransactionObserver:self]; 
     [[SKPaymentQueue defaultQueue] addPayment:payment]; 

     if ([SKPaymentQueue canMakePayments]) { 
      NSLog(@"Parental-controls are disabled"); 

      SKProductsRequest *productsRequest = [[SKProductsRequest alloc]   initWithProductIdentifiers:[NSSet setWithObject:@"com.test.app.V3"]]; 
      productsRequest.delegate = self; 
      [productsRequest start]; 
     } 
     else { 
      NSLog(@"Parental-controls are enabled"); 
     } 
    } 

    - (void)viewDidLoad { 
     [super viewDidLoad]; 
    } 

    -(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { 
     SKProduct *validProduct = nil; 
     int count = [response.products count]; 
     if (count > 0) { 
      validProduct = [response.products objectAtIndex:0]; 

     } 
     else if (!validProduct) { 
      NSLog(@"No Products Available"); 
     } 
    } 

    - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { 
     for (SKPaymentTransaction *transaction in transactions) { 
      switch (transaction.transactionState) { 

       case SKPaymentTransactionStatePurchasing: 
        //// Stuff Here //// 

        break; 

       case SKPaymentTransactionStatePurchased: 

        [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; 
        //// Stuff Here //// 

        activityIndicator.hidden = YES; 

        int coins1 = [money.text intValue]; 
        coins1 += 1500; 
        money.text = [NSString stringWithFormat:@"%d.00", coins1]; 

        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasBalance"]; 
        [[NSUserDefaults standardUserDefaults] setObject:money.text forKey:@"Balance"]; 

        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"ThankYou"]; 

        [self exitIAP]; 

        break; 

       case SKPaymentTransactionStateRestored: 
        [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; 
        break; 

       case SKPaymentTransactionStateFailed: 
        if (transaction.error.code != SKErrorPaymentCancelled) { 
         NSLog(@"An Error Encountered"); 
        } 
        [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; 
        //// Stuff Here //// 

        activityIndicator.hidden = YES; 
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"StopThankYou"]; 

        [self exitIAP]; 

        break; 
      } 
     } 
      } 

     - (void)exitIAP { 
    [[SKPaymentQueue defaultQueue] removeTransactionObserver:self]; 
     } 
    appreciate for any kind of help. 
    thanks in advance 

    crash report 
    Exception Type: EXC_CRASH (SIGABRT) 
    Exception Codes: 0x0000000000000000, 0x0000000000000000 
    Triggered by Thread: 0 

Last Exception Backtrace: 

    Thread 0 name: Dispatch queue: com.apple.main-thread 
    Thread 0 Crashed: 
    0 libsystem_kernel.dylib   0x3a13d1fc __pthread_kill + 8 
    libsystem_pthread.dylib   0x3a1a6a2e pthread_kill + 54 
    2 libsystem_c.dylib    0x3a0edff8 abort + 72 
    3 libc++abi.dylib     0x3941ccd2 abort_message + 70 
    4 libc++abi.dylib     0x394356e0 default_terminate_handler() + 248 
    5 libobjc.A.dylib     0x39b7e91e _objc_terminate() + 190 
    6 libc++abi.dylib     0x394331c4 std::__terminate(void (*)()) + 
    7 libc++abi.dylib     0x39432a18 __cxa_throw + 112 
    8 libobjc.A.dylib     0x39b7e77e objc_exception_throw + 246 
    9 CoreFoundation     0x2f30b8e2 -[NSObject(NSObject)    
    10 CoreFoundation     0x2f30a1c6 ___forwarding___ + 702 
    11 CoreFoundation     0x2f2594d4 _CF_forwarding_prep_0 + 20 
    12 DubstepSlots      0x0017cdce 0x90000 + 970190 
    13 StoreKit       0x31a0cdc8 __NotifyObserverAboutChanges  
    14 CoreFoundation     0x2f23b656 CFArrayApplyFunction + 34 
    15 StoreKit       0x31a0cd64 -[SKPaymentQueue  _no  
    16 StoreKit       0x31a0d646 -[SKPaymentQueue 
17 StoreKit      0x31a0dd1c -[SKPaymentQueue 
    18 StoreKit       0x31a0d80a __45-[SKPaymentQueue 
    19 libdispatch.dylib     0x3a061d18 
    20 libdispatch.dylib    0x3a061d04 _dispatch_client_callout + 20 

    22 CoreFoundation     0x2f2d2814 
    23 CoreFoundation     0x2f2d10e8 __CFRunLoopRun + 1296 
    24 CoreFoundation     0x2f23bc22 CFRunLoopRunSpecific + 518 
    25 CoreFoundation     0x2f23ba06 CFRunLoopRunInMode + 102 
    26 GraphicsServices     0x33f3c27e GSEventRunModal + 134 
    27 UIKit       0x31adf044 UIApplicationMain + 1132 
    28 DubstepSlots      0x000a2aaa 0x90000 + 76458 
    29 DubstepSlots      0x00092674 0x90000 + 9844 

    Thread 1 name: Dispatch queue: com.apple.libdispatch-manager 
    Thread 1: 
    0 libsystem_kernel.dylib   0x3a12a83c kevent64 + 24 
    1 libdispatch.dylib    0x3a06b210 _dispatch_mgr_invoke + 228 
    2 libdispatch.dylib    0x3a06af96   

Thread 2: 
0 libsystem_kernel.dylib   0x3a13dc7c __workq_kernreturn + 8 
    1 libsystem_pthread.dylib   0x3a1a3dc6 _pthread_wqthread + 306 
    2 libsystem_pthread.dylib   0x3a1a3c80 start_wqthread + 4 

    Thread 3 name: WebThread 
    Thread 3: 
0 libsystem_kernel.dylib   0x3a12aa8c mach_msg_trap + 20 
    1 libsystem_kernel.dylib   0x3a12a888 mach_msg + 44 
    2 CoreFoundation     0x2f2d27be __CFRunLoopServiceMachPort +  
    3 CoreFoundation     0x2f2d0ee4 __CFRunLoopRun + 780 
    4 CoreFoundation     0x2f23bc22 CFRunLoopRunSpecific + 518 
5 CoreFoundation     0x2f23ba06 CFRunLoopRunInMode + 102 
    6 WebCore       0x3742b266 RunWebThread(void*) + 414 
    7 libsystem_pthread.dylib   0x3a1a5c1a _pthread_body + 138 
    8 libsystem_pthread.dylib   0x3a1a5b8a _pthread_start + 98 
    9 libsystem_pthread.dylib   0x3a1a3c8c thread_start + 4 

Thread 4 name: Dispatch queue: com.apple.root.low-priority 
Thread 4: 
0 libsystem_kernel.dylib   0x3a12aadc semaphore_wait_trap + 8 
1 libdispatch.dylib    0x3a069428 _dispatch_semaphore_wait_slow + 172 
2 CFNetwork      0x2eecc6e0 CFURLConnectionSendSynchronousRequest + 264 
    3 Foundation      0x2fc947ae +[NSURLConnection 
4 Foundation      0x2fc648c6 -[NSData(NSData)  
5 Foundation      0x2fc647f6 +[NSData(NSData) 
6 DubstepSlots     0x000f5ea0 0x90000 + 417440 
7 DubstepSlots     0x000f5d4e 0x90000 + 417102 
8 libdispatch.dylib    0x3a061d18 _dispatch_call_block_and_release + 8 
9 libdispatch.dylib    0x3a068d6c _dispatch_root_queue_drain + 216 
10 libdispatch.dylib    0x3a068f54 _dispatch_worker_thread2 + 52 

11 libsystem_pthread.dylib 0x3a1a3dbc _pthread_wqthread + 296 12 libsystem_pthread.dylib 0x3a1a3c80 start_wqthread + 4

+2

請添加符號化的崩潰報告。 – rckoenes

回答

0

由於rckeones說,這將是很難跟蹤下來沒有symbolicated崩潰報告,但鑑於信息我們有,這些行激起我的興趣:

12 DubstepSlots      0x0017cdce 0x90000 + 970190 
13 StoreKit       0x31a0cdc8 __NotifyObserverAboutChanges  
14 CoreFoundation     0x2f23b656 CFArrayApplyFunction + 34 
15 StoreKit       0x31a0cd64 -[SKPaymentQueue  _no 

這意味着對我來說,SKPaymentQueue在呼喚它的觀察員(一個是東西在你的DubstepSlots項目),我在其中t正在崩潰。

看你的代碼,你要添加這個類作爲觀察員:

[[SKPaymentQueue defaultQueue] addTransactionObserver:self]; 

這種方法具有簽名

- (void)addTransactionObserver:(id<SKPaymentTransactionObserver>)observer 

這意味着你的self對象必須符合SKPaymentTransactionObserver協議。幸運的是,您的代碼中包含所需的方法- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions;。我很確定這是它崩潰的方法。但是如果你在這個方法的開始處設置一個斷點並且一步一步完成,我相信你會發現什麼是錯的。

我不知道是肯定的,但它似乎像線

8 libobjc.A.dylib     0x39b7e77e objc_exception_throw + 246 
9 CoreFoundation     0x2f30b8e2 -[NSObject(NSObject) 

表明,你可能會調用不在於方法的對象上存在的方法。

如果沒有符號化報告,很難判斷到底發生了什麼問題(我們甚至不知道它發生了什麼故障!)至少應該讓您開始發現問題出在哪裏。

+0

嘿我已經實現 - (void)paymentQueue :(SKPaymentQueue *)隊列updatedTransactions:(NSArray *)交易這個方法。獲取問題,雖然我已經提出了兩個版本的這個app.first被批准在ios6但在ios7午餐後我已經上傳第二個版本並被拒絕 – bhoomika

+0

我明白你已經實施了它。我很確定它正在被調用。我認爲這種情況正在發生。在其中放置一個斷點,並在iOS 7中調用該函數,我敢打賭你會發現它崩潰的地方(以及爲什麼)。 – cjwirth

+0

如果(transaction.error.code!= SKErrorPaymentCancelled)NSLog(@「An An Error Encoun」),我也有調試,但它的返回值爲 ; }在這種方法沒有任何崩潰在xcode文件,所以我不明白什麼是確切的問題是 – bhoomika

相關問題