小编Roy*_*Roy的帖子

在[[SKPaymentQueue defaultQueue] addPayment:payment]中的应用程序购买崩溃

我的应用内购买工作.我提出了一个带有"购买"UIButton的ModalView.单击该按钮,In App Purchase将完成整个过程.你甚至可以连续几次这样做.

如果您打开模态视图,然后关闭模态视图(使用UITabBarButtonItem),然后重新打开模态视图并点击"购买"按钮,则会出现此问题.该应用程序崩溃,我得到一个NSZombie读取

*** - [InAppPurchaseManager respondsToSelector:]:发送到解除分配的实例0x1c7ad0的消息

NSZombie指向.m文件中的第160行.我用评论标记了它.

我从这个页面得到了原始代码:http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/

我一直在努力奋斗很多天......任何帮助都会很棒.

这是.h

//
//  InAppPurchaseManager.h
//  Copyright 2010 __MyCompanyName__. All rights reserved.


#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>

#define kInAppPurchaseManagerProductsFetchedNotification @"kInAppPurchaseManagerProductsFetchedNotification"
#define kInAppPurchaseManagerTransactionFailedNotification @"kInAppPurchaseManagerTransactionFailedNotification"
#define kInAppPurchaseManagerTransactionSucceededNotification @"kInAppPurchaseManagerTransactionSucceededNotification"

#define kInAppPurchaseCreditProductId @"com.myname.app.iap"

@interface InAppPurchaseManager : UIViewController <SKProductsRequestDelegate, SKPaymentTransactionObserver>
{
    SKProduct *productID;
    SKProductsRequest *productsRequest;

 IBOutlet UIBarButtonItem *closeButton;
 IBOutlet UIButton *buyButton;
 IBOutlet UILabel *testLabel;

}

@property (retain, nonatomic) SKProduct *productID;
@property (retain, nonatomic) SKProductsRequest *productsRequest;

@property (retain, nonatomic) IBOutlet UIBarButtonItem *closeButton;
@property (retain, …
Run Code Online (Sandbox Code Playgroud)

iphone crash in-app-purchase nszombie

46
推荐指数
1
解决办法
2万
查看次数

为什么setWidth不起作用?

例如,对于Android中的TextView,您必须设置LayoutParams而不是setWidth方法.

TextView tv = new TextView(getContext());
LayoutParams params = new LayoutParams(100, LayoutParams.WRAP_CONTENT);
tv.setLayoutParams(params);
Run Code Online (Sandbox Code Playgroud)

但为什么?在Android文档中,它表示它会提供相同的结果.

android android-layout

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

绑定到usercontrol的DependencyProperty不会调用setter

我的页面xaml:

<header:DefaultText x:Name="header" HeaderText="{Binding Resources.HeaderTitle}"/>
Run Code Online (Sandbox Code Playgroud)

我的DefaultText.cs DependencyProperty:

    public string HeaderText
    {
        get { return (string)GetValue(HeaderTextProperty); }
        set
        {   //This part is never called when binding, but it is with static text
            SetValue(HeaderTextProperty, value);
            SetText(value);
        }
    }

    public readonly DependencyProperty HeaderTextProperty = DependencyProperty.Register("HeaderText", typeof(string), typeof(DefaultText), new PropertyMetadata(string.Empty));
Run Code Online (Sandbox Code Playgroud)

我的问题是,当我使用绑定设置HeaderText属性时,不会调用setter,但是当我使用没有绑定的普通字符串时,会调用它.

我已经尝试过类似问题的答案,例如:WPF Binding to variable/DependencyProperty

c# xaml dependency-properties windows-phone-8.1

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