I am trying to create a chat room in QuickBlox using my iOS app.
[[QBChat instance] createPrivateRoomWithName:#"My Room"];
- (void)createPrivateRoomWithName:(QBChatRoom*)room{
NSLog(#"Private room %# was created", room.name);
// Add users to this room
NSNumber *anny = [NSNumber numberWithInt:300];
NSNumber *jim = [NSNumber numberWithInt:357];
NSArray *users = [NSArray arrayWithObjects:anny, jim, nil];
[[QBChat instance] addUsers:users toRoom:room];
}
but after using this code my application is crashing, below is the crash log.
2013-01-03 19:13:55.234 Chat.Points[11178:23d03] +[QBDDXMLElement elementWithName:xmlns:]: unrecognized selector sent to class 0x22f73c
2013-01-03 19:13:55.241 Chat.Points[11178:23d03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[QBDDXMLElement elementWithName:xmlns:]: unrecognized selector sent to class 0x22f73c'
*** First throw call stack:
(0x32fe012 0x29eae7e 0x33892ad 0x32edbbc 0x32ed94e 0x101e05 0x2da153f 0x2db3014 0x2da3418 0x2da32a6 0x2da4280 0x2da3fcb 0x990f7b24 0x990f96fe)
libc++abi.dylib: terminate called throwing an exception
You have to login to QuickBlox Chat before creating room.
The solution is:
1) you have to add -ObjC flag to Other Linker Flags
2) Add to SplashController.h chat delegate QBChatDelegate
#interface SplashController : UIViewController <QBActionStatusDelegate, FBServiceResultDelegate, FBSessionDelegate, QBChatDelegate>{
3) Add to SplashController.m,
to if
}else if([result isKindOfClass:[QBMRegisterSubscriptionTaskResult class]]){
at the top next lines:
// Login to QuickBlox Chat
//
[[QBChat instance] setDelegate:self];
[DataManager shared].currentQBUser.password = [NSString stringWithFormat:#"%u", [[[DataManager shared].currentFBUser objectForKey:kId] hash]];
[[QBChat instance] loginWithUser:[DataManager shared].currentQBUser];
//
//
4) Finally, add to the end
#pragma mark-
#pragma mark QBChatDelegate
- (void)chatDidLogin{
[[QBChat instance] createPrivateRoomWithName:#"ChatRRoom"];
}
- (void)chatRoomDidCreate:(QBChatRoom *)room{
NSLog(#"Room did create %#", room);
myRoom = [room retain];
}
Just Add -ObjC flag in Other Linker Flags in your targets' settings. Hope it will solve your problem.
Related
I got a strange error. After I installed my test app in release mode I got an error:
[SomeMapView setRotateEnabled:]: unrecognized selector sent to instance 0x1c58ac40
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SomeMapView setRotateEnabled:]: unrecognized selector sent to instance 0x1c58ac40'
The Mapview was initialized and in the init method I was trying to deactivate the rotation. In the debugging mode it worked fine.
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[self setRotateEnabled:FALSE];
[self initDelegate];
}
return self;
}
Maybe someone knows what's going on? Thanks in advance.
It was a problem in the iOS version. RotateEnabled in available only in iOS7 like Suresh point out. I had to check if the property was there (or check if it has iOS7) like
if ([self respondsToSelector:NSSelectorFromString(elementName)])
{
[self setValue:elementInnerText forKey:elementName];
}
I am using new FB IOS SDK and app crash and get below error
Assertion failure in -FBCacheIndex
_updateEntryInDatabaseForKey:entry:, /Users/chrisp/src/ios-sdk/src/FBCacheIndex.m Terminating app due to
uncaught exception 'NSInternalInconsistencyException', reason: ''
* First throw call stack: (0x334072a3 0x3b0a197f 0x3340715d 0x33cdcb13 0x10b3b1 0x10b635 0x10a7bf 0x3b4b911f 0x3b4b899b 0x3b4b8895
0x3b4c7215 0x3b4c73b9 0x3b4eda11 0x3b4ed8a4)
I have made google and found solution like -lsqlite3.0 in other linker flag and add -lsqlite3 framework, FBsession missing. and i have done all but still i am getting same issue.
My code as below:
in FBClass.m which is NSObject type
-(void) getFriendListForInvitation
{
# try {
if (self.friendPickerController == nil) {
// Create friend picker, and get data loaded into it.
self.friendPickerController = [[FBFriendPickerViewController alloc] init];
self.friendPickerController.title = #"Invite Friends";
self.friendPickerController.delegate = self;
[self.friendPickerController clearSelection];
[self.friendPickerController loadData];
self.friendPickerController.itemPicturesEnabled = TRUE;
}
else{
[self.friendPickerController clearSelection];
[self.friendPickerController updateView];
}
self.friendPickerController.allowsMultipleSelection = FALSE;
// iOS 5.0+ apps should use [UIViewController presentViewController:animated:completion:]
// rather than this deprecated method, but we want our samples to run on iOS 4.x as well.
if([[[UIDevice currentDevice] systemVersion] intValue] >= 5.0)
[[[appdelegate.navigationController viewControllers] lastObject] presentViewController:self.friendPickerController animated:TRUE completion:nil];
else
[[[appdelegate.navigationController viewControllers] lastObject] presentModalViewController:self.friendPickerController animated:YES];
}
#catch (NSException *exception) {
NSLog(#"%#",[exception description]);
}
}
Please help me to solve this issue.....
thanks
Did you manage to solve the issue? I suffer from the same problem.
I determined that this exception is caused by the missing file cache.db in the directory facebook is addressing to. You can check that with the help of the simulator. The directory of the missing simulator file is:
/Users/<user name>/Library/Application Support/iPhone Simulator/6.1/Applications/<app id>/Library/Caches/DataDiskCache
Yet I do not know why the file is missing.
EDIT:
The only thing I came up with was to clear the session data from the app with simple two lines of code:
FBSession.activeSession = nil;
[[NSUserDefaults standardUserDefaults] removeObjectForKey:#"FBAccessTokenInformationKey"];
Unfortunately this solution never actually closes the session but at least it is providing the proper workflow of the app.
I am implementing Google+ in Objective-C iPhone using Google+ for iOS tutorials but when I click on sign-in button of Google+ I am getting this error
2013-01-14 14:28:46.168 googleplus_tutorials[2468:11303] GTMMethodCheckMethodChecker: Class WebMIMETypeRegistry does not conform to #protocol(NSObject), so won't be checked
2013-01-14 14:28:46.176 googleplus_tutorials[2468:11303] GTMMethodCheckMethodChecker: Class UIKeyboardCandidateUtilities does not conform to #protocol(NSObject), so won't be checked
2013-01-14 14:28:55.544 googleplus_tutorials[2468:11303] *** Assertion failure in -[GPPSignInButton createGPPSignIn], /Volumes/BuildData/pulse-data/agents/wpyk8.hot/recipes/211255319/base/googlemac/Shared/GooglePlus/Dev/GooglePlusPlatform/GPPSignInButton.m:155
2013-01-14 14:28:55.545 googleplus_tutorials[2468:11303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'You must specify a client ID for GPPSignInButton.'
*** First throw call stack:
(0x141e012 0x1243e7e 0x141de78 0xcd9f35 0x448c4 0x44688 0x1257705 0x18e920 0x18e8b8 0x24f671 0x24fbcf 0x24ed38 0x1be33f 0x1be552 0x19c3aa 0x18dcf8 0x2301df9 0x2301ad0 0x1393bf5 0x1393962 0x13c4bb6 0x13c3f44 0x13c3e1b 0x23007e3 0x2300668 0x18b65c 0x2e22 0x2d55)
libc++abi.dylib: terminate called throwing an exception
using this link i am implementing google+ in my iphone
https://developers.google.com/+/mobile/ios/getting-started
and this is my code
- (void)viewDidLoad
{
[super viewDidLoad];
static NSString * const kClientId = #"711430132123.apps.googleusercontent.com";
GPPShare *share = [[GPPShare alloc] initWithClientID:kClientId];
signInButton = [[GPPSignInButton alloc]init];
signInButton.delegate = self;
signInButton.clientID = kClientId;
signInButton.scope = [NSArray arrayWithObjects:#"https://www.googleapis.com/auth/plus.moments.write",#"https://www.googleapis.com/auth/plus.me",nil];
AppDelegate *appDelegate = (AppDelegate *)
[[UIApplication sharedApplication] delegate];
appDelegate.signInButton = signInButton;
// Do any additional setup after loading the view, typically from a nib.
}
- (BOOL)application: (UIApplication *)application
openURL: (NSURL *)url
sourceApplication: (NSString *)sourceApplication
annotation: (id)annotation {
// Handle Google+ sign-in button URL.
if ([signInButton handleURL:url
sourceApplication:sourceApplication
annotation:annotation]) {
return YES;
}
return NO;
}
Kindly tell me why I am getting this error.
Have you tried with universalLib(libGooglePlusUniversal.a) of google+? After tracking your crash i think that you have not added the lib in your target.May be it will help you.
a few days ago I had this working where after you login to facebook you can click a button and an FBFriendPickerViewController would appear with a list of all facebook friends. However, suddenly it has started to crash with some weird errors. Here is my code:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [FBSession.activeSession handleOpenURL:url];
}
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// attempt to extract a token from the url
return [FBSession.activeSession handleOpenURL:url];
}
In my home viewcontroller.m
// Pick Friends button handler
- (IBAction)pickFriendsClick:(UIButton *)sender {
// Create friend picker, and get data loaded into it.
FBFriendPickerViewController *friendPicker = [[FBFriendPickerViewController alloc] init];
self.friendPickerController = friendPicker;
[friendPicker loadData];
// Create navigation controller related UI for the friend picker.
friendPicker.navigationItem.title = #"Pick Friends";
friendPicker.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
initWithTitle:#"Done"
style:UIBarButtonItemStyleBordered
target:self
action:#selector(friendPickerDoneButtonWasPressed:)];
friendPicker.navigationItem.hidesBackButton = YES;
// Make current.
[self.navigationController pushViewController:friendPicker animated:YES];
}
// Handler for when friend picker is dismissed
- (void)friendPickerDoneButtonWasPressed:(id)sender {
[self.navigationController popViewControllerAnimated:YES];
NSString *message;
if (self.friendPickerController.selection.count == 0) {
message = #"<No Friends Selected>";
} else {
NSMutableString *text = [[NSMutableString alloc] init];
// we pick up the users from the selection, and create a string that we use to update the text view
// at the bottom of the display; note that self.selection is a property inherited from our base class
for (id<FBGraphUser> user in self.friendPickerController.selection) {
if ([text length]) {
[text appendString:#", "];
}
[text appendString:user.name];
}
message = text;
}
[[[UIAlertView alloc] initWithTitle:#"You Picked:"
message:message
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil]
show];
}
And finally here is the error message I am getting when the button set up to the pickFriendsClick method is hit:
2012-07-18 19:22:14.978 MeetUp[7213:1dc03] -[__NSDictionaryI length]: unrecognized selector sent to instance 0xa9b7c70
2012-07-18 19:22:14.980 MeetUp[7213:1dc03] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI length]: unrecognized selector sent to instance 0xa9b7c70'
* First throw call stack:
(0x1f626a2 0x13ede7e 0x1feda3d 0x1f522bc 0x1f5204e 0x1edd7d0 0x1ef5c98 0x1fcff7b 0x1ef5b42 0xde4d5a 0xe3ace8 0xe3ac93 0x20138 0x20718 0x410ffb 0x4110cf 0x3f9e1d 0x40a4db 0x3a79ba 0x14016be 0x25a53a6 0x259973c 0x2599550 0x2517690 0x25187fb 0x2518eb6 0x1f2b27e 0x1f2b1bd 0x1f08f22 0x1f086a4 0x1f0857b 0x1a7a913 0x1a7a798 0x358e7c 0x205d 0x1f85)
libc++abi.dylib: terminate called throwing an exception
Again, the login and logout functionality I have implemented is working great, and this was working not too long ago however now it is giving me trouble. Any help would be greatly appreciated. Thanks!
EDIT:
Okay so I added this line of code:
[friendPicker setItemPicturesEnabled:NO];
and it now works however obviously I do not get the little thumbnail profile pictures in the tableview cells.
I guess the error is that it for some reason crashes (SIGABRT) when it is trying to load the profile pictures. If anyone knows why this is that would be great, especially seeing as it worked and loaded the pictures a couple days ago.
Going to add your content to the answer as I came across the same issue and tldr and missed the hack solution.
The stack trace shows an exception being thrown at a line:
[FBGraphObjectTableDataSource tableView:imageForItem:]
Ergo setting:
self.friendPickerController.itemPicturesEnabled = NO;
seems to fix the issue as it won't load images.
this is my coding am used to get local top 10 highscore but , debugging terminated error occurs.
[OFHighScoreService getPageWithLoggedInUserForLeaderboard: theLeaderboardID onSuccess:OFDelegate(self, #selector(_scoresDownloaded:))
onFailure:OFDelegate()];
selector:-
- (void)_scoresDownloaded:(OFPaginatedSeries*)page
{
NSMutableArray* highscores = nil;
if ([page count] > 0)
{
if ([[page objectAtIndex:0] isKindOfClass:[OFTableSectionDescription class]])
{
highscores = [(OFTableSectionDescription*)[page objectAtIndex:0] page].objects;
}
else
{
highscores = page.objects;
}
}
NSString *userID = [OpenFeint lastLoggedInUserName];
for (OFHighScore* score in highscores)
{
ccColor3B theColor = ccBLACK;
if ([score.user.name isEqualToString: userID] ) {
//score now contains the users data... Do what I want with it.
NSLog(#"%d %# %d", score.rank, score.user.name, score.score);
break;
}
}
}
this is my console window error:-
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Levelone canReceiveCallbacksNow]: unrecognized selector sent to instance 0x6af2070'
*** Call stack at first throw:
terminate called after throwing an instance of 'NSException'
As the error says, the object you are using as the callback delegate for OFHighScoreService does not recognize the selector canReceiveCallbacksNow. As per OpenFeint documentation, your callback must implement the OFCallbackable protocol which defines this. Simply implement the function, e.g. just have it return YES all the time.
OpenFeint only stores the latest qualifying score per player on a given leaderboard. No user would ever appear ranked at more than one slot on a leaderboard.