Hi I am using gamekit to connect two IOS device for transferring data between them, below is the code iam using here
.h
#property (nonatomic,strong)GKSession *sessionObj;
...
.m
...
GKPeerPickerController *connectionPicker = [[GKPeerPickerController alloc] init];
connectionPicker.delegate = self;
//NOTE - GKPeerPickerConnectionTypeNearby is for Bluetooth connection, you can do the same thing over Wi-Fi with different type of connection
connectionPicker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;
[connectionPicker show];
sessionObj = [[GKSession alloc] initWithSessionID:#"com.myapp.connect" displayName:nil sessionMode:GKSessionModePeer];
sessionObj.delegate = self;
so when i run the app it goes to GKPeerPickerControllerDelegate
-(GKSession *)peerPickerController:(GKPeerPickerController *)picker sessionForConnectionType:(GKPeerPickerConnectionType)type{
return sessionObj;
}
and once this it return from this delegate method it throw an error which say's
*** Terminating app due to uncaught exception 'GKInvalidArgumentException', reason: 'A vaild GKSession object with a GKSessionModePeer mode must be supplied, or to create a default GKSession object return 'nil' in the implementation of -peerPickerController:sessionForConnectionType:. Supplied object was: (null description) with session mode: 0'
*** First throw call stack:
(0x1335052 0x1155d0a 0x12dda78 0x12dd9e9 0x665e0 0x65798 0x64e9a 0x64e13 0x5d15cb 0x64cf7 0x63237 0xb781 0xb438 0x5099d6 0x50a8a6 0x519743 0x51a1f8 0x50daa9 0x1d67fa9 0x13091c5 0x126e022 0x126c90a 0x126bdb4 0x126bccb 0x50a2a7 0x50ba9b 0xc12d 0x75f5 0x1)
terminate called throwing an exception(lldb)
Can you please let me know what's wrong in here.
Related
I am developing an application for video call, but when try to make call application crash with following error
2014-12-30 00:00:50.866 closeChat[28683:3791106] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString xmlChar]: unrecognized selector sent to instance 0x19b4a8'
*** First throw call stack:
(0x29e5949f 0x3764fc8b 0x29e5e8b9 0x29e5c7d7 0x29d8e058 0xf2bc5 0xee3a9 0x89923 0x89d89 0x29e1627b 0x88c05 0x889af 0x371b3 0x2d34c9fb 0x2d34c9a1 0x2d337613 0x2d34c40d 0x2d3111ad 0x29e1fd95 0x29e1d453 0x29e1d85b 0x29d6b3c1 0x29d6b1d3 0x311690a9 0x2d37afa1 0x67189 0x37bcfaaf)
libc++abi.dylib: terminating with uncaught exception of type NSException
I used the following code:
self.videoChat = [[QBChat instance] createAndRegisterVideoChatInstance];
self.videoChat.viewToRenderOpponentVideoStream = self.imgOppenentViewView;
self.videoChat.viewToRenderOwnVideoStream = self.imgOwnVideoView;
self.videoChat.useHeadphone = 1;
self.videoChat.useBackCamera = 1;
NSMutableDictionary *videoChatConfiguration = [[QBSettings videoChatConfiguration] mutableCopy];
//
[videoChatConfiguration setObject:AVCaptureSessionPresetLow forKey:kQBVideoChatFrameQualityPreset];
[videoChatConfiguration setObject:#10 forKey:kQBVideoChatVideoFramesPerSecond];
//
[QBSettings setVideoChatConfiguration:videoChatConfiguration];
[QBChat instance].delegate = self;
[self.videoChat callUser:[self.opponentID intValue] conferenceType:QBVideoChatConferenceTypeAudioAndVideo];
I've tested video sample Quickblox with your settings and video call works as expected.
Please try to setup Quickblox with CocoaPods and see if error happens again
http://quickblox.com/developers/IOS-how-to-connect-Quickblox-framework#CocoaPods
And there is a new WebRTC sample you can test. It has more features and preferred to use.
I am trying to setup push notifications using Urban Airship and I believe I'm having a problem with the provisioning profiles or ssl certificates. The app is not prompting the user for Push Notifications permissions but I am not getting a 'no valid "aps-environment" entitlement string found for application' message, and I can see the aps-environment entitlement in the .mobileprovision.
I can't find any documentation on +[UAirship executeUnsafeTakeOff:] so I am wondering if anyone knows what that could mean?
Also, the device token is being returned as nil, as logged by Urban Airship:
[D] -[UAPush updateRegistrationForcefully:] [Line 544] Device token is
nil. Registration will be attempted at a later time
There is no Urban Airship code running prior to the [UAirship takeOff:config] call, and the app does not crash as a result of the error.
Without knowing much about Urban Airship I can offer a guess.
takeOff ensures that the actual implementation provided in executeUnsafeTakeoff only happens once. It makes sure that the current thread is the main thread and then ensures that it only happens once.
Therefore getting an executeUnsafeTakeoff error really only tells you that something went wrong, such as if the configfailed tovalidate` (see below).
You need to make sure that the app can receive push notifications, as you mentioned.
Here is takeOff:
+ (void)takeOff {
[UAirship takeOff:[UAConfig defaultConfig]];
}
+ (void)takeOff:(UAConfig *)config {
// takeOff needs to be run on the main thread
if (![[NSThread currentThread] isMainThread]) {
NSException *mainThreadException = [NSException exceptionWithName:UAirshipTakeOffBackgroundThreadException
reason:#"UAirship takeOff must be called on the main thread."
userInfo:nil];
[mainThreadException raise];
}
dispatch_once(&takeOffPred_, ^{
[UAirship executeUnsafeTakeOff:config];
});
}
Here is executeUnsafeTakeoff:
/*
* This is an unsafe version of takeOff - use takeOff: instead for dispatch_once
*/
+ (void)executeUnsafeTakeOff:(UAConfig *)config {
// Airships only take off once!
if (_sharedAirship) {
return;
}
[UAirship setLogLevel:config.logLevel];
_sharedAirship = [[UAirship alloc] init];
_sharedAirship.config = config;
// Ensure that app credentials have been passed in
if (![config validate]) {
UA_LERR(#"The AirshipConfig.plist file is missing and no application credentials were specified at runtime.");
// Bail now. Don't continue the takeOff sequence.
return;
}
UA_LINFO(#"App Key: %#", _sharedAirship.config.appKey);
UA_LINFO(#"App Secret: %#", _sharedAirship.config.appSecret);
UA_LINFO(#"Server: %#", _sharedAirship.config.deviceAPIURL);
if (config.automaticSetupEnabled) {
_sharedAirship.appDelegate = [[UAAppDelegateProxy alloc ]init];
//swap pointers with the initial app delegate
#synchronized ([UIApplication sharedApplication]) {
_sharedAirship.appDelegate.originalAppDelegate = [UIApplication sharedApplication].delegate;
_sharedAirship.appDelegate.airshipAppDelegate = [[UAAppDelegate alloc] init];
[UIApplication sharedApplication].delegate = _sharedAirship.appDelegate;
}
}
// Build a custom user agent with the app key and name
[_sharedAirship configureUserAgent];
// Set up analytics
_sharedAirship.analytics = [[UAAnalytics alloc] initWithConfig:_sharedAirship.config];
[_sharedAirship.analytics delayNextSend:UAAnalyticsFirstBatchUploadInterval];
/*
* Handle Debug Options
*/
//For testing, set this value in AirshipConfig to clear out
//the keychain credentials, as they will otherwise be persisted
//even when the application is uninstalled.
if (config.clearKeychain) {
UA_LDEBUG(#"Deleting the keychain credentials");
[UAKeychainUtils deleteKeychainValue:_sharedAirship.config.appKey];
UA_LDEBUG(#"Deleting the UA device ID");
[UAKeychainUtils deleteKeychainValue:kUAKeychainDeviceIDKey];
}
if (!config.inProduction) {
[_sharedAirship validate];
}
if (config.cacheDiskSizeInMB > 0) {
UA_LINFO("Registering UAURLProtocol");
[NSURLProtocol registerClass:[UAURLProtocol class]];
}
// The singleton is now ready for use!
_sharedAirship.ready = true;
//create/setup user (begin listening for device token changes)
[[UAUser defaultUser] initializeUser];
}
I am working on a project which requires integration with cocoalibspotify. I have some unit test cases for the classes that import CocoaLibSpotify.h. Those test cases have failed with the following stack trace:
Assertion failure in NSString* base::deviceIdFromKeychain()(), /Users/spotify-buildagent/buildAgent/work/1e0ce8a77adfb2dc/client/base/_apple/_ios/os_ios.mm:287
2013-10-20 11:14:03.505 * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Keychain error when fetching device ID, nonrecoverable'
* First throw call stack:
(0x30f0cf53 0x3b2366af 0x30f0ce2d 0x318b41df 0x2d142f 0x2d1a09 0x2ce6db 0x17b1b5 0x1798b3 0x30ed81b9 0x30ed753b 0x30ed5e45 0x30e40ce7 0x30e84803 0x179b1d 0x318efe27 0x3b85dc1d 0x3b85db8f 0x3b85bc90)
libc++abi.dylib: terminating with uncaught exception of type NSException
The method at which the exception is thrown is in the SPSession.m class: CFRunLoopRun();
+(void)runBackgroundRunloop:(dispatch_block_t)runLoopReadyBlock {
#autoreleasepool {
[NSThread currentThread].name = #"com.spotify.CocoaLibSpotify";
[runloopReadyLock lock];
libspotify_runloop = CFRunLoopGetCurrent();
sleep(1);
libspotifyThread = [NSThread currentThread];
// Use a custom, no-op run loop source to keep the loop alive and fast.
CFRunLoopSourceContext libspotify_source_context;
memset(&libspotify_source_context, 0, sizeof(CFRunLoopSourceContext));
libspotify_runloop_source = CFRunLoopSourceCreate(NULL, 0, &libspotify_source_context);
CFRunLoopAddSource(libspotify_runloop, libspotify_runloop_source, kCFRunLoopDefaultMode);
[runloopReadyLock unlockWithCondition:1];
CFRunLoopRun();
CFRelease(libspotify_runloop_source);
CFRelease(libspotify_runloop);
libspotify_runloop_source = NULL;
libspotify_runloop = NULL;
libspotifyThread = nil;
}
}
I have no clue what causes the error or how to fix it. Does anyone have any idea about this?
Thanks,
Make sure you're using the latest version of CocoaLibSpotify (2.4.5).
Also, how are the unit tests run? Does your app run correctly? Does CocoaLibSpotify's own unit test suite run? It's worth noting that the Keychain is unaccessible to CocoaLibSpotify before the device has been unlocked.
I am getting this exception:
2013-08-06 21:48:05.046 entrepreneur[13200:11f03] Not purchased: 1
2013-08-06 21:48:09.075 entrepreneur[13200:11f03] Buying (null)...
2013-08-06 21:48:09.077 entrepreneur[13200:11f03] Buying (null)...
2013-08-06 21:48:09.079 entrepreneur[13200:11f03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid product identifier: (null)'
*** First throw call stack:
(0x1691012 0x1123e7e 0x1690deb 0x3c7dc 0x18d5f 0x1a4be 0x1137705 0x6e920 0x6e8b8 0x12f671 0x12fbcf 0x12ed38 0x9e33f 0x9e552 0x7c3aa 0x6dcf8 0x14dbdf9 0x14dbad0 0x1606bf5 0x1606962 0x1637bb6 0x1636f44 0x1636e1b 0x14da7e3 0x14da668 0x6b65c 0x2a1d 0x2945)
libc++abi.dylib: terminate called throwing an exception
Because the product seems to be nil. Here is how I put the product object together:
This is the method which is called when the "subscribe" button is called:
- (IBAction)subscribe:(id)sender
{
UIButton *buyButton = (UIButton *)sender;
SKProduct *product = _products[buyButton.tag];
NSLog(#"Buying %#...", product.productIdentifier);
[[RageIAPHelper sharedInstance] buyProduct:product];
}
I am working from this tutorial:
http://www.raywenderlich.com/21081/introduction-to-in-app-purchases-in-ios-6-tutorial
And I don't really understand how they can be creating the product object which seems like it would be empty. But when it is empty, it gives an exception down the line.
Is there something I am not doing quite right here?
Thanks!
I'm creating a login and registration for my app. Every time I run this code I recieve this error:
#import <UIKit/UIKit.h>
#import "THRAppDelegate.h"
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([THRAppDelegate class]));
}
}
Can someone tell me what it means? I believe its happening from the server side(PHP)
Also the JSON response I keep getting is error: False
Here is the php code:
function registerUser($email, $name, $username, $password){
$uuid = uniqid('', true);
$hash = hashSSHA($password);
$encrypted_password = $hash["encrypted"]; //encrypted password
$salt = $hash["salt"]; //salt password
$register = query("SELECT email FROM users WHERE email='$email' limit 1");
if (count($register['result'])>0) {
errorJson('This email is already registered. Try to login or recover your password.');
}
//try to register the user
$result = query("INSERT INTO users(unique_id, name, email, username, encrypted_password, salt) VALUES('$uuid', '$name', '$email','$username', '$encrypted_password', '$salt', NOW())");
if (!$result['error']) {
//success
login($email, $password);
} else {
//error
//errorJson('Sorry, something went wrong :( . Please try again later.');
errorJson(mysql_error());
}
}
function login($email, $password){
$result = query("SELECT uid, email FROM users WHERE email ='%s' AND password ='%s' limit 1", $email, $password);
if (count($result['result'])>0) {
$salt = $result['salt'];
$encrypted_password = $result['encrypted_password'];
$hash = checkhashSSHA($salt, $password);
//checking for password equality
if ($encrypted_password == $hash) {
//user authentication details are correct
return $result;
//authorized
$_SESSION['uid'] = $result['result'][0]['uid'];
print json_encode($result);
}
} else {
//not authorized
errorJson('Wrong Email and password combination.');
}
}
function hashSSHA($password){
$salt = sha1(rand());
$salt = substr($salt, 0,10);
$encrypted = base64_encode(sha1($password . $salt, true) . $salt);
$hash = array("salt" => $salt, "encrypted" => $encrypted);
return $hash;
}
/*
*Decrypting password
*#param salt. pasword
returns hash string
*/
function checkhashSSHA($salt, $password){
$hash = base64_encode(sha1($password.$salt, true) . $salt);
return $hash;
}
Xcode error
2012-10-11 15:04:42.528 Thryfting[1457:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFBoolean isEqualToString:]: unrecognized selector sent to instance 0x1883964'
*** First throw call stack:
(0x1752012 0x1577e7e 0x17dd4bd 0x1741bbc 0x174194e 0x6184af 0x618674 0x8b0706 0x8be578 0x8beb50 0x1b5fb 0x1ce4c 0x1e6fb 0xed99 0x1f0753f 0x1f19014 0x1f097d5 0x16f8af5 0x16f7f44 0x16f7e1b 0x2c827e3 0x2c82668 0x4bf65c 0x2bad 0x2ad5 0x1)
libc++abi.dylib: terminate called throwing an exception
You can trace your code by Zombie objects:
⌥⌘R
select the "Diagnostics" tab and click "Enable Zombie Objects":
This turns released objects into NSZombie instances that print console warnings when used again. This is a debugging aid that increases memory use (no object is really released) but improves error reporting.
A typical case is when you over-release an object and you don't know which one:
With zombies: -[UITextView release]: message sent to deallocated instance
Without zombies:
So, as far as I see, your error is
[__NSCFBoolean isEqualToString:]: unrecognized selector....
This means that, somewhere in your code (can't tell you where, since you dont provide it) you are sending isEqualToString message to an object that is not a NSString.
Could you please make a quick search and see where are you sending that message? It could be that you are reading a boolean value but treating it as a NSString. Please, check your code, and verify that you check the type of data before you send that message.
Please, provide the piece of code where that could happen.