Paypal iphone integration error - iphone

[PayPal initializeWithAppID:#"APP-80W284485P519543T" forEnvironment:ENV_SANDBOX];
UIButton *button = [[PayPal getInstance] getPayButtonWithTarget:self andAction:#selector(payWithPayPal) andButtonType:BUTTON_278x43];
Any one of line, If I am writting in my application's viewDidLoad or appDidFinishLauch, then it works fine on simulator, but while I do run it on iOS5 (iPod Touch) it gives the following error, and goes hang or crash...
Program received signal: “EXC_BAD_ACCESS”.
warning: check_safe_call: could not restore current frame
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Can't find dlopen function, so it is not possible to load shared libraries.)
What is meaning of this issue, and how to solve it?
NOTE: The issue is only in iOS5, in all other devices and simulators, its working fine,
I am using Mac OS 10.6 and SDK is 4.
Can anyone has issue like this, or know how to solve it?

Related

CBCentralManager changes for iOS 7

I am trying to use Apple's 'BTLE Transfer' sample project to understand CoreBluetooth programming. The app runs fine if I use an iOS 6 device as the Central, but if I run the same app with the iOS 7 device as the Central it doesn't work. The peripheral stops sending after two packets, and the central doesn't receive either one of them.
The only clue is this warning that I get only when running on iOS 7:
CoreBluetooth[WARNING] <CBCentralManager: 0x15654540> is disabling duplicate filtering, but is using the default queue (main thread) for delegate events
Can anyone tell me what needs to change to make this app compatible with iOS 7?
EDIT: When both devices are iOS7 there are no issues. This only breaks when an iOS7 central is talking to a iOS6 peripheral.
Okay I just ran it on an iOS 7 central to iOS 6 peripheral. If you want to make that warning about disabling duplicate filtering go away, just run it on a different thread. Do something like this:
dispatch_queue_t centralQueue = dispatch_queue_create("com.yo.mycentral", DISPATCH_QUEUE_SERIAL);// or however you want to create your dispatch_queue_t
_centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:centralQueue];
Now it will allow you to scan with duplicates enabled. However, you must call the textView setter on the main thread to be able to set the text without crashing:
dispatch_async(dispatch_get_main_queue(), ^{
[self.textview setText:[[NSString alloc] initWithData:self.data encoding:NSUTF8StringEncoding]];
});
Btw you probably also want to adopt the new iOS 7 delegate initialization:
_centralManager = [[CBCentralManager alloc]initWithDelegate:self queue:centralQueue options:nil];//set the restoration options if you want
(Just check the iOS version and call the appropriate initialization method)
InscanForPeripheralsWithServices:options:,if you set CBCentralManagerScanOptionAllowDuplicatesKey:#YES then change it to
CBCentralManagerScanOptionAllowDuplicatesKey:#NOthat means scan should run without duplicate filtering.
For me,it works on iOS7 also.

iPhone Simulator 6.0 not able to connect to gamecenter in sandbox mode

I'm trying to implement a gamecenter aware app targeted to iOS 6. To give some info on the environment I'm working on mac os 10.7.5 with XCode version is 4.5.2 and xcode is running iphone and ipad simulator version 6.0. The problem is I cannot connect to gamecenter in sandbox mode neither through ipad or iphone simulator, but the same code works as desired while testing in my iphone.
I followed the gamecenter programming guide in apple's developer library and I got this atm it is called from applicationDidFInishLaunching in appdelegate:
- (void)authenticateLocalUser:(UIViewController *)currentViewController
{
if (!gameCenterAvailable) return;
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
localPlayer.authenticateHandler = ^(UIViewController *viewController, NSError *error){
if (viewController != nil)
{
[currentViewController presentViewController:viewController animated:YES completion:nil];
}
else if (localPlayer.isAuthenticated)
{
NSLog(#"Player authenticated");
}
else
{
NSLog(#"Player not authenticated");
}
NSLog(#"Error: %#",error);
};
}
It outputs:
Error: Error Domain=GKErrorDomain Code=2 "The requested operation has been cancelled."
UserInfo=0x8690510 {NSLocalizedDescription=The requested operation has been cancelled.}
GKSConnSettings: set server: {
"gk-cdx" = "17.173.254.218:4398";
"gk-commnat-cohort" = "17.173.254.220:16386";
"gk-commnat-main0" = "17.173.254.219:16384";
"gk-commnat-main1" = "17.173.254.219:16385";
}
I already tried hosts file fix though my OS is not 10.8.2 but it didn't help. https://devforums.apple.com/thread/168811?tstart=0
Any idea what can be the possible cause?
Edit: Well, it turns out the output part starting with GKSConnSettings does not indicate any problems, that's the regular output while connecting to game center as I understood from what I read over internet. I printed the actual error message (GKErrorDomain = 2 ...) inside the authentication block.
I got the inspiration from : https://stackoverflow.com/a/8115807/837244, and decided to log in to game center account with a different piece of code. So in viewdidload I normally called:
[[GCHelper sharedInstance] authenticateLocalUser:self];
Now I commented that out, accessed game center through below URL scheme, logged in to my account and after that logged out.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:"]];
And lastly reverted back by commenting out URL code and using the original code. Now it works fine, I guess the problem was that a game center account was already hooked up in simulator and it denied every login request bc of that. Hope apple goes clearer with error messages, it took a month to fix such a simple issue, may this help to others.
I know this question references specific Xcode and iOS simulation versions, but if your simulator is already logged in one account, and you don't mind losing whatever data you've got on the simulator (chances are small, but you never know), you can simply reset the settings and data on it.
Go to:
Simulator -> Reset Content and Settings...
...and confirm the action when prompted.
This is certainly true for Xcode7.x running an iOS 9.x simulator, someone else might be able to verify whether it's true for earlier versions (especially as I've unearthed quite an old question and answer).
Animal451
Necrothreadomancy: +1

Iphone App can not be open after the iphone power off

I met a strange problem about IOS which I can't find the way to fix.
I'm developing an App on iPhone.
It works fine when I run it in Simulator or on my iPhone device.
It works fine when I shut down my iPhone and restart the iPhone.
But it can not be opened after my iPhone's is power off, still can't be opened after the iPhone has been charged.
But when I reconnect the iPhone to the Xcode without reinstall it, it can be opened.
I don't know what the problem is and what worse is that I can't debug it cos it works fine when I debug it.
I think that must be a CoreData problem and I did something in the applicationWillTerminate method:
(void)applicationWillTerminate:(UIApplication *)application {
....
NSError *error;
if (managedObjectContext != nil) {
if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) {
// Handle the error.
}
}
}
What else am I supported to do? is there some delegate method like applicationWillTerminateWhenPowerOff to let me save the CoreData ? Or am I lose something ?
Update:
I fix it now. After checking the device log in organizer of Xcode, I find out the reason why it can't be opened.
It miss the SenTestingKit frame.
You probably have a bug in applicationDidFinishLaunching or another routine called when your application starts up.
First check for crash logs in Xcode's Organizer with the device connected.
You could also put some logging code in all of your UIApplication delegate routines to see which routines (if any) are getting called and perhaps throwing an exception. NSLogger is a nice utility for that since it can log from an iPhone to a Mac over WiFi.

how to gather Instruments memory/zombies data after removing & restarting app in the simulator?

How can I gather Instruments memory/zombies data after removing app in simulator and restarting in simulator?
What I see in the simulator after I remove the app process, and then retart it by clicking on it's icon in the simulator, is that Instruments has stopped receiving the data from the application?
Background
I'm trying to test saving and loading data via NSUserDefaults. After saving it to test the loading part I need to simulate removing the app from memory, so what I have been doing is manually removing the app process on the simulator (double click on menu button etc).
What I'm finding is that when I do run up the app this way there is some problem at start up - getting "Thread 1 - Program received signal SIGKILL" against the " int retVal = UIApplicationMain(argc, argv, nil, nil);" line of code
Therefore I thought I would try to run in Instruments to track down the issue, hence my question as Instruments seems to "stop recording" after I kill the app process on the simulator and then restart.
Not possible (i.e. no answers yet so I'm guessing the correct answer may be that it's not possible)

Audio will play in 3.2 sim but not in 4.x

This streaming audio app will play in 3.2 simulator, but not in 4.x sim or my 4.1 iPhone.
The console logs are as follows:
4.0 Sim
This GDB was configured as "x86_64-apple-darwin".Attaching to process 13237.
[Switching to process 13237]
2010-11-15 19:54:49.606 Issues[13237:1c07] AddRunningClient starting device on non-zero client count
2010-11-15 19:55:16.220 Issues[13237:6307] AQMEIO_Base::DoStartIO: timeout
2010-11-15 19:55:16.498 Issues[13237:6307] AQMEDevice::StartIO: error -66681
2010-11-15 19:55:16.499 Issues[13237:6307] CA_UISoundClientBase::StartPlaying: AddRunningClient failed (status = -66681).
2010-11-15 19:55:46.499 Issues[13237:1c07] AQMEIO_Base::DoStartIO: timeout
2010-11-15 19:55:46.777 Issues[13237:1c07] AQMEDevice::StartIO: error -66681
2010-11-15 19:55:46.778 Issues[13237:1c07] Audio queue start failed. err: ˇ˛˚á -66681
[Switching to process 13237]
4.1 Device
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys001
target remote-mobile /tmp/.XcodeGDBRemote-11399-40
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
[Switching to thread 11523]
[Switching to thread 11523]
sharedlibrary apply-load-rules all
[Switching to thread 13059]
[Switching to thread 11523]
If it makes you feel better, I have had this exact problem for a couple weeks with no solution in sight. I think it occurred when I upgraded my ipad to 4.2 but I am not sure. I was still able to use the 3.2 simulator for my music app testing, but now I have been making my app universal and there is no way to test the iphone code on the simulator.
EDIT: I fixed it!!
The only other google search result for this error led me to poke around in my audio settings. I have a Blackmagic Intensity Pro HDMI capture card and it was set as my audio input device. I changed it to "Line in" or whatever, restarted my Mac, and then the simulator worked again!
I was also messing around with my audio output settings, so it's hard to know for sure what actually solved it, but the key is: mess around with your audio settings, restart your Mac and cross your fingers.
one more edit: I had this same problem occur with a webcam on my other, work computer. I changed the audio from the input of the web cam back to line in, and it worked again. How are more people not seeing this?
I had this problem, and fixed it by unplugging an external microphone which was hooked up via USB. Not sure why this fixed it, but it did.
I have the problem too, but i fixed it in some minutes, thank to Ethical. Although the problem is same, my code is different, my code supplie in the video player. My code run good in the ipad/iphone device, but not in simulator. When the video start playing, the simulator freezon, the output is like you, but i remember i plug in the earphone just now, and pull out some miniutes later, so the setting of audio player changed, i think. So, i plug in the earphone again and restart my mac. The problem solved. So just restart your mac, or check the setting of audio player.
+1 .... Checking and changing the Mac's audio input also worked for me. I had no sound in the simulator (Mac Pro) but my app worked fine on the device (iPad 3) calling
[[SimpleAudioEngine sharedEngine] playEffect:#"soundname.caf"];
In the sim, there was a long lag after first trying to play a sound (my app seemed to hang, with high CPU usage). After a long time it would give a AQMEIO_Base::DoStartIO: timeout error and the app would resume, albeit without sound. Happened every time I ran it.
The sound output was shown as line out, but sound input was set to digital. Changing the input to line in made sound work in the simulator.
There is still a cascade of warnings in the sim on startup, starting with:
Error loading
/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn:
dlopen(/System/Library/Extensions/AudioIPCDriver.kext/Contents/Resources/AudioIPCPlugIn.bundle/Contents/MacOS/AudioIPCPlugIn,
262): Symbol not found: ___CFObjCIsCollectable Referenced from:
/System/Library/Frameworks/Security.framework/Versions/A/Security
Expected in:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
in /System/Library/Frameworks/Security.framework/Versions/A/Security
and ending in
Default audio device changed. Restart the simulator to have it use the newly-selected device.
But sound now works and I can test the app using the simulator.
Try to play your audio on MPMovidePlayerController instead of MPMediaPlayer