Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Tiiba

macrumors newbie
Original poster
Jul 9, 2010
11
0
Paypal:

I'm trying to get my Iphone program to make a payment. I created a sandbox account, and then followed the instructions here:

https://www.x.com/community/ppx/xspaces/mobile/mep

Here is what I wrote:

PHP:
	[PayPal initializeWithAppID:@"APP-80W284485P519543T" forEnvironment:ENV_SANDBOX];
	PayPal *pp = [PayPal getInstance];
	PayPalMEPPayment *payment =[[PayPalMEPPayment alloc] init];
	
	payment.paymentCurrency = @"USD";
	payment.paymentAmount = @"10.00";
	payment.itemDesc = @"[a string]";
	payment.recipient = @"[email of the sandbox business account]";
	payment.merchantName = @"We R Igors";
	[pp Checkout:payment];
	[payment release];
}

I ran the program and saw a popup asking for my login. I tried the email of the personal account, with the number substring as the password. I tried the info for the business account, because that's what was in "API credentials". I tried the developer site login. None of them work. I don't know what I'm supposed to enter. Or is the problem that I need to do something special, like signing the program? I don't think I need to yet, plus I don't know how.


Threads:
Another one, not related. If I need to put this in a new thread, inform me, I'm not sure. I have a table in a nav controller, and each row has a downloaded image. Images are downloaded asynchronously:

PHP:
[NSThread detachNewThreadSelector:@selector(doDownload:) toTarget:self withObject:urlAddr];

Well, this worked great for a while. Then something changed, and while the threads do indeed detach, the screen stays black until everything is loaded. The root controller's constructor runs to the end, but the method that fills the rows doesn't get called until the end. This means that I made the program complicated and got no benefit. What could it be? Did I use locking wrong?

Here's doDownload:

PHP:
-(void)doDownload:(NSString*)urlAddr
{	
	NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	
	@synchronized(self)
	{
		NSURL* url = [NSURL URLWithString: urlAddr];
		NSData* data = [NSData dataWithContentsOfURL: url];
		[data retain];
		img = [UIImage imageWithData:data];
		imageView = [[UIImageView alloc] initWithImage:img];
		[self addSubview:imageView];
		imageView.frame = self.bounds;
		[imageView setNeedsLayout];
		[self setNeedsLayout];
		[imageView retain];
	}
	
    [pool release];
	BOOL a = [NSThread isMultiThreaded];
}

In the GUI, I use the nav controller to switch between several tables. If the row's image is already downloaded, I construct a new imageview. Else, I use the view ImageDownloader, from which the above code comes.

GUI:

Sometimes, when I back up the navigation controller, a text view in the cell I just clicked on seems to be overlapped with either another cell's corresponding view or with a dislocated copy of itself. I dutifully remove old copies from the "ReusableCellWithIdentifier". What do I need to do? Perhaps force the cell to repaint? How?
 
You should make separate threads for each question.

Your threads question is answered by telling you that UIKit is not thread safe, at least not most of it. You can't create a UIImageView or addSubview or anything like that in any thread but the main thread. Look at the LazyTableImages Apple sample code which shows how to do this.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.