0

我无法让这个工作,所有的示例代码似乎都已被弃用。我已经能够更新很多常量,但有没有人有任何样本。我有一个沙盒应用程序 ID。到目前为止,我已经添加了库:

@interface PaymentViewController ()
@property (weak, nonatomic) IBOutlet UIButton *paypalButton;
@end

- (void)viewDidLoad {
  [super viewDidLoad];

  // 1. spawn a new thread to initialize the paypal library
  // TODO: spawn a new thread
  [PayPal initializeWithAppID:SANDBOX_APP_ID forEnvironment:ENV_SANDBOX];

  // 2. generate the 'pay with paypal' button
  self.paypalButton = [[PayPal getInstance] getPayButtonWithTarget:self 
                                                         andAction:@selector(payWithPayPal) 
                                                     andButtonType:BUTTON_278x43
                                                     andButtonText:BUTTON_TEXT_PAY];
}

  // 3. add the payment details
  // 4. wait for callback
4

2 回答 2

0

是的。我刚刚让它在带有 ARC 的 iOS 5 上运行。

于 2012-06-08T04:27:04.097 回答
0

由于从未真正回答过此问题,因此我将继续为其他人填写。希望能帮助到你。

您将需要找到所有放置在库中的所有内容,它使用“分配”进行属性定义并将任何动态内存指针更改为“保留”,但不要理会任何静态分配的变量。

例如:

@property (nonatomic, assign) id<ListChoiceDelegate> choiceDelegate;
@property (nonatomic, assign) NSArray *items;

更改为

@property (nonatomic, retain) id<ListChoiceDelegate> choiceDelegate; 
@property (nonatomic, retain) NSArray *items;

但...

@property (nonatomic, assign) NSUInteger groupId;

保持不变。

然后你需要找到所有用 [[blah alloc] autorelease]; 包裹的分配。并删除包装自动释放和括号:

[[[PaymentSuccessViewController alloc] init] autorelease]

成为

[[PaymentSuccessViewController alloc] init]

然后删除其中任何一个:

[super dealloc];
于 2013-08-16T21:38:36.610 回答