Just switched to XCode 5 and iOS 7 on my macbook , thoughts everything will work correctly since I wasn't doing anything special but it doesn't work.
I had facebook integration on my 6.1 app ,this is what I was doing:
- (IBAction)facebookTapped:(UIButton *)sender {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//Check if the net is reachable
SLComposeViewController * faceSheet=[self.socialIntegration showFacebook:@"text" andImage:nil andLink:@"link" andView:self];
dispatch_sync(dispatch_get_main_queue(), ^{
//[self netConnectionTrue:cell Connected:answer];
//[tempAlertView show];
[self presentViewController:faceSheet animated:YES completion:NO];
});
});
}
now when I press the button this is what I get:
+[SocailIntegration modalTransitionStyle]: unrecognized selector sent to class 0x49b30
and the app breaks on this line: [self presentViewController:faceSheet animated:YES completion:NO];
anyone knows why this might happen?
EDIT:This is my code in socialIntegration class:
-(SLComposeViewController *) showFacebook:(NSString *) initialText andImage:(NSString *) imageName andLink:(NSString *) link andView:(UIViewController *) controller {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook])
{
SLComposeViewController *faceSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[faceSheet setInitialText:initialText];
if (imageName.length!=0)
{
[faceSheet addImage:[UIImage imageNamed:imageName]];
}
if (link.length!=0)
{
[faceSheet addURL:[NSURL URLWithString:link]];
}
return faceSheet;
//[controller presentViewController:faceSheet animated:YES completion:nil];
}
else
{
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Sorry"
message:@"You can't send a status right now, make sure your device has an internet connection and you have at least one Facebook account setup"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}
Your custom socialIntegration
class has a bug in it. It only returns a SLComposeViewController
if Facebook is available on the device. If it isn't, it returns nothing.
However, you don't test for this when you actually call it:
SLComposeViewController * faceSheet=[self.socialIntegration showFacebook:@"text" andImage:nil andLink:@"link" andView:self];
dispatch_sync(dispatch_get_main_queue(), ^{
//[self netConnectionTrue:cell Connected:answer];
//[tempAlertView show];
[self presentViewController:faceSheet animated:YES completion:NO];
});
...you're not checking to see if faceSheet
is nil. So if there's no Facebook account you call presentViewController
with a nil object, which triggers the error you're seeing.
The reason you are seeing this on iOS 7 is your linked FB accounts probably got reset, but it was probably a source of crashes for your users on iOS 6 as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.