I am using Xcode 6 beta with iOS 8 on the iPhone 5s the iphone 4s is standard ios 7.1 phone.
The app runs great on the iPhone 5s but as soon as a try a iphone 4s or the iPhone 4s simulator.
the app breaks out and throws the following error
dyld: Symbol not found: _NSURLAuthenticationMethodClientCertificate
Referenced from: /Users/MIkeAspinall 1/Library/Developer/CoreSimulator/Devices/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/data/Applications/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/WeddingsAndMore.app/WeddingsAndMore
Expected in: /Applications/Xcode6-Beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/Frameworks/CFNetwork.framework/CFNetwork
in /Users/MIkeAspinall 1/Library/Developer/CoreSimulator/Devices/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/data/Applications/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx/WeddingsAndMore.app/WeddingsAndMore
(lldb)
I'm not sure why this is happening. But the iPhone 5s simulator throws the same error. It just seems to run on the iOS 8.
the settings are set for an ios 7.1 phone
im also using parse.com for my data access
My Phone is Iphone 5s Running ios 8 beta
iphone 4s is running ios 7.1
simulators are running in xcode 6beta
app is set to run on ios 7.1 or above.
i'm using xcode 6beta
hope that clears up what i have
opening code on first view controler
#interface DMKHomeViewController (UIViewcontroller )
#end
#implementation DMKHomeViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
-(BOOL) hasInternet{
Reachability *reach = [Reachability reachabilityWithHostName:#"www.bbc.co.uk"];
NetworkStatus internetStats = [reach currentReachabilityStatus];
if (internetStats == NotReachable) {
UIAlertView *alertOne = [[UIAlertView alloc] initWithTitle:#"No Internet Connection" message:#" A connection To The Internet IS Required While Running This App. Please Reconnect To Continue" delegate:self cancelButtonTitle:#"Ok" otherButtonTitles:#"Cancel", nil];
[alertOne show];
}
else {
UIAlertView *alerttwo = [[UIAlertView alloc] initWithTitle:#"Internet Connection Active" message:#"A connection To The Internet IS Required While Running This App. Your Connection Is Live... Thankyou." delegate:self cancelButtonTitle:#"OK" otherButtonTitles:#"Cancel", nil];
[alerttwo show];
}
return YES;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self hasInternet];
if (![PFUser currentUser]) { // No user logged in
// Create the log in view controller
PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
[logInViewController setDelegate:self]; // Set ourselves as the delegate
// Create the sign up view controller
PFSignUpViewController *signUpViewController = [[PFSignUpViewController alloc] init];
[signUpViewController setDelegate:self]; // Set ourselves as the delegate
// Assign our sign up controller to be displayed from the login controller
[logInViewController setSignUpController:signUpViewController];
// Present the log in view controller
[self presentViewController:logInViewController animated:YES completion:NULL];
}
}
// Sent to the delegate to determine whether the log in request should be submitted to the server.
- (BOOL)logInViewController:(PFLogInViewController *)logInController shouldBeginLogInWithUsername: (NSString *)username password:(NSString *)password {
// Check if both fields are completed
if (username && password && username.length != 0 && password.length != 0) {
return YES; // Begin login process
}
[[[UIAlertView alloc] initWithTitle:#"Missing Information"
message:#"Make sure you fill out all of the information!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil] show];
return NO; // Interrupt login process
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.canDisplayBannerAds = YES;
}
// Sent to the delegate to determine whether the sign up request should be submitted to the server.
- (BOOL)signUpViewController:(PFSignUpViewController *)signUpController shouldBeginSignUp:(NSDictionary *)info {
BOOL informationComplete = YES;
// loop through all of the submitted data
for (id key in info) {
NSString *field = [info objectForKey:key];
if (!field || field.length == 0) { // check completion
informationComplete = NO;
break;
}
}
// Display an alert if a field wasn't completed
if (!informationComplete) {
[[[UIAlertView alloc] initWithTitle:#"Missing Information"
message:#"Make sure you fill out all of the information!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil] show];
}
return informationComplete;
}
// Sent to the delegate when a PFUser is signed up.
- (void)signUpViewController:(PFSignUpViewController *)signUpController didSignUpUser:(PFUser *)user {
[self dismissViewControllerAnimated:YES completion:NULL]; // Dismiss the PFSignUpViewController
}
// Sent to the delegate when the sign up attempt fails.
- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError: (NSError *)error {
NSLog(#"Failed to sign up...");
}
// Sent to the delegate when the sign up screen is dismissed.
- (void)signUpViewControllerDidCancelSignUp:(PFSignUpViewController *)signUpController {
NSLog(#"User dismissed the signUpViewController");
}
// Sent to the delegate when a PFUser is logged in.
- (void)logInViewController:(PFLogInViewController *)logInController didLogInUser:(PFUser *)user {
[self dismissViewControllerAnimated:YES completion:NULL];
}
// Sent to the delegate when the log in attempt fails.
- (void)logInViewController:(PFLogInViewController *)logInController didFailToLogInWithError: (NSError *)error {
NSLog(#"Failed to log in...");
}
// Sent to the delegate when the log in screen is dismissed.
- (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController {
[self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
DMKHomeViewController *destination = [segue destinationViewController];
destination.interstitialPresentationPolicy = ADInterstitialPresentationPolicyAutomatic;
}
- (IBAction)Logout:(id)sender {
[PFUser logOut];
// Present the log in view controller
if (![PFUser currentUser]) { // No user logged in
// Create the log in view controller
PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
[logInViewController setDelegate:self]; // Set ourselves as the delegate
// Create the sign up view controller
PFSignUpViewController *signUpViewController = [[PFSignUpViewController alloc] init];
[signUpViewController setDelegate:self]; // Set ourselves as the delegate
// Assign our sign up controller to be displayed from the login controller
[logInViewController setSignUpController:signUpViewController];
// Present the log in view controller
[self presentViewController:logInViewController animated:YES completion:NULL];
}
}
Related
In my main view controller, when a button is pressed I run the following code:
if (![PFUser currentUser]) { // No user logged in
// Create the log in view controller
CustomSignUp *logInViewController = [[CustomSignUp alloc] init];
[logInViewController setDelegate:self]; // Set ourselves as the delegate
// Create the sign up view controller
self.signUpViewController = [[TheActualSignUp alloc] init];
[self.signUpViewController setDelegate:self]; // Set ourselves as the delegate
self.signUpViewController.fields = (PFSignUpFieldsUsernameAndPassword
| PFSignUpFieldsSignUpButton
| PFSignUpFieldsEmail
| PFSignUpFieldsAdditional
| PFSignUpFieldsDismissButton);
[self.signUpViewController.signUpView.additionalField setPlaceholder:#"First & Last Name"];
[logInViewController setSignUpController:self.signUpViewController];
logInViewController.facebookPermissions = #[ #"email", #"public_profile", #"user_friends" ];
logInViewController.fields = (PFLogInFieldsUsernameAndPassword
| PFLogInFieldsFacebook
| PFLogInFieldsTwitter
| PFLogInFieldsLogInButton
| PFLogInFieldsSignUpButton
| PFLogInFieldsPasswordForgotten);
// Present the log in view controller
[self.navigationController pushViewController:logInViewController animated:YES];
}
The view controller for a login screen shows up, and I can successfully log in an already created user. However, when I try to sign up someone, I run into issues. The sign up window appears fine, and I type in all the codes, but when I click the button to send the info in to sign it up, nothing happens. Here is the code (in the same view controller). Would greatly appreciate any help on this. Am using Parse on Buddy.com. None of the NSLogs are getting called when signing up.
- (BOOL)logInViewController:(PFLogInViewController *)logInController shouldBeginLogInWithUsername:(NSString *)username password:(NSString *)password {
// Check if both fields are completed
if (username && password && username.length != 0 && password.length != 0) {
return YES; // Begin login process
}
[[[UIAlertView alloc] initWithTitle:#"Missing Information"
message:#"Make sure you fill out all of the information!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil] show];
return NO; // Interrupt login process
}
// Sent to the delegate when a PFUser is logged in.
- (void)logInViewController:(PFLogInViewController *)logInController didLogInUser:(PFUser *)user {
PFUser *me = [PFUser currentUser];
NSLog(#"Regular Login");
[self dismissViewControllerAnimated:YES completion:NULL];
}
- (void)logInViewController:(PFLogInViewController *)logInController didFailToLogInWithError:(NSError *)error {
NSLog(#"Failed to log in...%#", error);
}
// Sent to the delegate when the log in screen is dismissed.
- (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController {
[self.navigationController popViewControllerAnimated:YES];
}
- (BOOL)signUpViewController:(PFSignUpViewController *)signUpController shouldBeginSignUp:(NSDictionary *)info {
NSLog(#"Signup");
BOOL informationComplete = YES;
// loop through all of the submitted data
for (id key in info) {
NSString *field = [info objectForKey:key];
if (!field || field.length == 0 || ![signUpController.signUpView.additionalField.text containsString:#" "] ) { // check completion
informationComplete = NO;
break;
}
}
// Display an alert if a field wasn't completed
if (!informationComplete) {
[[[UIAlertView alloc] initWithTitle:#"Missing Information"
message:#"Make sure you fill out all of the information, including first & last name!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil] show];
}
return informationComplete;
}
- (void)signUpViewController:(PFSignUpViewController *)signUpController didSignUpUser:(PFUser *)user {
NSLog(#"Signed them up");
[user saveEventually];
[self dismissViewControllerAnimated:YES completion:nil]; // Dismiss the PFSignUpViewController
}
// Sent to the delegate when the sign up attempt fails.
- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError:(NSError *)error {
NSLog(#"Failed to sign up...");
}
// Sent to the delegate when the sign up screen is dismissed.
- (void)signUpViewControllerDidCancelSignUp:(PFSignUpViewController *)signUpController {
NSLog(#"User dismissed the signUpViewController");
}
Looking through your code, it's not immediately obvious as to what the problem is. If you ping Parse on Buddy's customer support at support#buddy.com, we can help.
Previously on iOS7, I have tested my SMS module and it worked nicely. After updating the iOS version, I noticed that the SMS module have some problems.
In my .h file
#import <MessageUI/MFMessageComposeViewController.h>
#interface ViewController : UIViewController<UITextFieldDelegate,MFMessageComposeViewControllerDelegate>
In my .m file
- (void)sendSMS:(NSString *)bodyOfMessage recipientList:(NSArray *)recipients
{
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
if([MFMessageComposeViewController canSendText])
{
controller.body = bodyOfMessage;
controller.recipients = recipients;
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}
}
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
if (result == MessageComposeResultCancelled){
NSLog(#"Message cancelled");
}
else if (result == MessageComposeResultSent){
NSLog(#"Message sent");
}
else{
NSLog(#"Message failed");
}
}
After I press send, in the log have show "Message sent" but the view is still at the message screen. I have no idea why it will not go back to my application.
Need help to find the problem to why it will not go back to my application.
Thanks in advance.
It seems you are not dismissing the mailcomposer after it is presented. You will have to dismiss the presented MFMessageComposeViewController in the following method:
-(void)mailComposeController:(MFMailComposeViewController *)controller
didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
if (result == MessageComposeResultCancelled){
NSLog(#"Message cancelled");
}
else if (result == MessageComposeResultSent){
NSLog(#"Message sent");
}
else{
NSLog(#"Message failed");
}
[self dismissViewControllerAnimated:YES completion:nil]; //<---- This line
}
Moreover, - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated is deprecated since iOS 6. Use - (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion instead like this:
[self presentViewController:mailComposer animated:YES completion:nil];
hii everyone i am new on this professional site.actually i have a problem in PayPal iOS SDK 2.0.5. This sdk is downloaded from github and now when I tried to logged in paypal then it is not authenticating Can anyone tell that why is this happening and payment is also not transferred in business account from personal account
Thankx
Please help me
here is the link
https://github.com/paypal/PayPal-iOS-SDK/archive/master.zip
#define kPayPalEnvironment PayPalEnvironmentNoNetwork
#interface ZZMainViewController ()
#property(nonatomic, strong, readwrite) IBOutlet UIButton *payNowButton;
#property(nonatomic, strong, readwrite) IBOutlet UIButton *payFutureButton;
#property(nonatomic, strong, readwrite) IBOutlet UIView *successView;
#property(nonatomic, strong, readwrite) PayPalConfiguration *payPalConfig;
#end
#implementation ZZMainViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = #"PayPal SDK Demo";
// Set up payPalConfig
_payPalConfig = [[PayPalConfiguration alloc] init];
_payPalConfig.acceptCreditCards = YES;
_payPalConfig.languageOrLocale = #"en";
_payPalConfig.merchantName = #"Awesome Shirts, Inc.";
_payPalConfig.merchantPrivacyPolicyURL = [NSURL URLWithString:#"https://www.paypal.com/webapps/mpp/ua/privacy-full"];
_payPalConfig.merchantUserAgreementURL = [NSURL URLWithString:#"https://www.paypal.com/webapps/mpp/ua/useragreement-full"];
// Setting the languageOrLocale property is optional.
//
// If you do not set languageOrLocale, then the PayPalPaymentViewController will present
// its user interface according to the device's current language setting.
//
// Setting languageOrLocale to a particular language (e.g., #"es" for Spanish) or
// locale (e.g., #"es_MX" for Mexican Spanish) forces the PayPalPaymentViewController
// to use that language/locale.
//
// For full details, including a list of available languages and locales, see PayPalPaymentViewController.h.
_payPalConfig.languageOrLocale = [NSLocale preferredLanguages][0];
// Do any additional setup after loading the view, typically from a nib.
self.successView.hidden = YES;
// use default environment, should be Production in real life
self.environment = kPayPalEnvironment;
NSLog(#"PayPal iOS SDK version: %#", [PayPalMobile libraryVersion]);
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:YES];
// Preconnect to PayPal early
[PayPalMobile preconnectWithEnvironment:self.environment];
}
#pragma mark - Receive Single Payment
- (IBAction)pay {
// Remove our last completed payment, just for demo purposes.
self.resultText = nil;
PayPalPayment *payment = [[PayPalPayment alloc] init];
payment.amount = [[NSDecimalNumber alloc] initWithString:#"9.95"];
payment.currencyCode = #"USD";
payment.shortDescription = #"Hipster t-shirt";
if (!payment.processable) {
// This particular payment will always be processable. If, for
// example, the amount was negative or the shortDescription was
// empty, this payment wouldn't be processable, and you'd want
// to handle that here.
}
// Update payPalConfig re accepting credit cards.
self.payPalConfig.acceptCreditCards = self.acceptCreditCards;
PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc] initWithPayment:payment
configuration:self.payPalConfig
delegate:self];
[self presentViewController:paymentViewController animated:YES completion:nil];
}
- (void)payPalPaymentViewController:(PayPalPaymentViewController *)paymentViewController didCompletePayment:(PayPalPayment *)completedPayment {
NSLog(#"PayPal Payment Success!");
self.resultText = [completedPayment description];
[self showSuccess];
[self sendCompletedPaymentToServer:completedPayment]; // Payment was processed successfully; send to server for verification and fulfillment
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)payPalPaymentDidCancel:(PayPalPaymentViewController *)paymentViewController {
NSLog(#"PayPal Payment Canceled");
self.resultText = nil;
self.successView.hidden = YES;
[self dismissViewControllerAnimated:YES completion:nil];
}
#pragma mark Proof of payment validation
- (void)sendCompletedPaymentToServer:(PayPalPayment *)completedPayment {
// TODO: Send completedPayment.confirmation to server
NSLog(#"Here is your proof of payment:\n\n%#\n\nSend this to your server for c onfirmation and fulfillment.", completedPayment.confirmation);
}
#pragma mark - Authorize Future Payments
- (IBAction)getUserAuthorization:(id)sender {
PayPalFuturePaymentViewController *futurePaymentViewController = [[PayPalFuturePaymentViewController alloc] initWithConfiguration:self.payPalConfig delegate:self];
[self presentViewController:futurePaymentViewController animated:YES completion:nil];
}
#pragma mark PayPalFuturePaymentDelegate methods
- (void)payPalFuturePaymentViewController:(PayPalFuturePaymentViewController *)futurePaymentViewController didAuthorizeFuturePayment:(NSDictionary *)futurePaymentAuthorization {
NSLog(#"PayPal Future Payment Authorization Success!");
self.resultText = futurePaymentAuthorization[#"code"];
[self showSuccess];
[self sendAuthorizationToServer:futurePaymentAuthorization];
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)payPalFuturePaymentDidCancel:(PayPalFuturePaymentViewController *)futurePaymentViewController {
NSLog(#"PayPal Future Payment Authorization Canceled");
self.successView.hidden = YES;
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)sendAuthorizationToServer:(NSDictionary *)authorization {
// TODO: Send authorization to server
NSLog(#"Here is your authorization:\n\n%#\n\nSend this to your server to complete future payment setup.", authorization);
}
#pragma mark - Helpers
- (void)showSuccess {
self.successView.hidden = NO;
self.successView.alpha = 1.0f;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:2.0];
self.successView.alpha = 0.0f;
[UIView commitAnimations];
}
#pragma mark - Flipside View Controller
- (void)flipsideViewControllerDidFinish:(ZZFlipsideViewController *)controller {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
[self dismissViewControllerAnimated:YES completion:nil];
} else {
[self.flipsidePopoverController dismissPopoverAnimated:YES];
self.flipsidePopoverController = nil;
}
}
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
self.flipsidePopoverController = nil;
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:#"pushSettings"]) {
[[segue destinationViewController] setDelegate:self];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
UIPopoverController *popoverController = [(UIStoryboardPopoverSegue *)segue popoverController];
self.flipsidePopoverController = popoverController;
popoverController.delegate = self;
}
}
}
- (IBAction)togglePopover:(id)sender {
if (self.flipsidePopoverController) {
[self.flipsidePopoverController dismissPopoverAnimated:YES];
self.flipsidePopoverController = nil;
} else {
[self performSegueWithIdentifier:#"showAlternate" sender:sender];
}
}
#end
You are not authenticating the email and password because you have your environment set to PayPalEnvironmentNoNetwork. Setting it to NoNetwork sets it to a "mock" environment and just simulates the actions. You'll need to set the environment to either Live or Sandbox in order to process/authenticate with those environments. The below code is the relevant snippet that you need to look at...
// Set the environment:
// - For live charges, use PayPalEnvironmentProduction (default).
// - To use the PayPal sandbox, use PayPalEnvironmentSandbox.
// - For testing, use PayPalEnvironmentNoNetwork.
#define kPayPalEnvironment PayPalEnvironmentSandbox
I'm trying to get a project working with Parse and Facebook. When running this project, the build fails and I get a Mach-O Linker Error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SLComposeViewController", referenced from:
objc-class-ref in Parse(PF_Twitter.o)
"_OBJC_CLASS_$_SLRequest", referenced from:
objc-class-ref in Parse(PF_Twitter.o)
"_SLServiceTypeTwitter", referenced from:
-[PF_Twitter getAccessTokenForReverseAuthAsync:localTwitterAccount:] in Parse(PF_Twitter.o)
-[PF_Twitter getLocalTwitterAccountAsync] in Parse(PF_Twitter.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ViewController.h:
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
#interface ViewController : UIViewController
#end
// Implement both delegates
#interface DefaultSettingsViewController :
UIViewController <PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate>
#end
And the ViewController.m:
#import "ViewController.h"
#interface ViewController ()
#end
#implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
// Sent to the delegate to determine whether the log in request should be submitted to the server.
- (BOOL)logInViewController:(PFLogInViewController *)logInController shouldBeginLogInWithUsername:(NSString *)username password:(NSString *)password {
// Check if both fields are completed
if (username && password && username.length != 0 && password.length != 0) {
return YES; // Begin login process
}
[[[UIAlertView alloc] initWithTitle:#"Missing Information"
message:#"Make sure you fill out all of the information!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil] show];
return NO; // Interrupt login process
}
// Sent to the delegate when a PFUser is logged in.
- (void)logInViewController:(PFLogInViewController *)logInController didLogInUser:(PFUser *)user {
[self dismissViewControllerAnimated:YES completion:NULL];
}
// Sent to the delegate when the log in attempt fails.
- (void)logInViewController:(PFLogInViewController *)logInController didFailToLogInWithError:(NSError *)error {
NSLog(#"Failed to log in...");
}
// Sent to the delegate when the log in screen is dismissed.
- (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController {
[self.navigationController popViewControllerAnimated:YES];
}
// Sent to the delegate to determine whether the sign up request should be submitted to the server.
- (BOOL)signUpViewController:(PFSignUpViewController *)signUpController shouldBeginSignUp:(NSDictionary *)info {
BOOL informationComplete = YES;
// loop through all of the submitted data
for (id key in info) {
NSString *field = [info objectForKey:key];
if (!field || field.length == 0) { // check completion
informationComplete = NO;
break;
}
}
// Display an alert if a field wasn't completed
if (!informationComplete) {
[[[UIAlertView alloc] initWithTitle:#"Missing Information"
message:#"Make sure you fill out all of the information!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil] show];
}
return informationComplete;
}
// Sent to the delegate when a PFUser is signed up.
- (void)signUpViewController:(PFSignUpViewController *)signUpController didSignUpUser:(PFUser *)user {
[self dismissModalViewControllerAnimated:YES]; // Dismiss the PFSignUpViewController
}
// Sent to the delegate when the sign up attempt fails.
- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError:(NSError *)error {
NSLog(#"Failed to sign up...");
}
// Sent to the delegate when the sign up screen is dismissed.
- (void)signUpViewControllerDidCancelSignUp:(PFSignUpViewController *)signUpController {
NSLog(#"User dismissed the signUpViewController");
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (![PFUser currentUser]) {
// Customize the Log In View Controller
PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
[logInViewController setDelegate:self];
[logInViewController setFacebookPermissions:[NSArray arrayWithObjects:#"friends_about_me", nil]];
[logInViewController setFields: PFLogInFieldsFacebook | PFLogInFieldsDismissButton];
// Present Log In View Controller
[self presentViewController:logInViewController animated:YES completion:NULL];
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
Any help is appreciated, thanks.
From what I see, it seems like you didn't add the Social.framework in your project. Try to link it by following the intructions there :
Linking to a Library or Framework
Just add:
<framework>Social</framework>
to robovm.xml under <frameworks> tag.
I'm developing an app for FB wall posting in ios using facebook sdk 3.5. I'm using two views. Firts one is a splash screen and a second one is the facebook login view. When i'm activate both views I'm getting a thread and error displayed,
2013-05-17 17:07:59.115 [415:12503] * Assertion failure in -[FBSession checkThreadAffinity], /Users/chrisp/tmp/sdk/ios-sdk/src/FBSession.m:1571
2013-05-17 17:07:59.127 [415:12503] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FBSession: should only be used from a single thread'
* First throw call stack:
(0x2387052 0x1fa3d0a 0x232fa78 0x1a9c2db 0x21fa2 0x1e626 0x1ecd9 0x22b67 0x1eba3 0x3c265 0x2388ec9 0x11165c2 0x111655a 0x11bbb76 0x11bc03f 0x11bb2fe 0x113ba30 0x113bc56 0x1122384 0x1115aa9 0x293ffa9 0x235b1c5 0x22c0022 0x22be90a 0x22bddb4 0x22bdccb 0x293e879 0x293e93e 0x1113a9b 0x2be2 0x2b15)
terminate called throwing an exception(lldb)
Here is my Appdelegate.m code,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]autorelease];
// Override point for customization after application launch.
self.viewController = [[[SplashViewController alloc] initWithNibName:#"SplashViewController" bundle:nil]autorelease] ;
// self.loginViewController = [[secondview alloc] initWithNibName:#"secondview"
// bundle:nil];
// self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.loginViewController];
// self.navigationController.delegate = self;
// self.window.rootViewController = self.navigationController;
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
//
//
UIBackgroundTaskIdentifier backgroundTask = [application beginBackgroundTaskWithExpirationHandler:^{NSLog(#"BackgroundTask Expiration Handler is called");
[application endBackgroundTask:backgroundTask];
}];
And this is the facebook_view.m code
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.navigationController.navigationBarHidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
self.navigationController.navigationBarHidden = NO;
}
- (void)viewDidUnload {
[self setFBLoginView:nil];
[super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#pragma mark - FBLoginView delegate
- (void)loginViewShowingLoggedInUser:(FBLoginView *)loginView {
// Upon login, transition to the main UI by pushing it onto the navigation stack.
TNLRadioAppDelegate *appDelegate = (TNLRadioAppDelegate *)[UIApplication sharedApplication].delegate;
[self.navigationController pushViewController:((UIViewController *)appDelegate.viewController) animated:YES];
}
- (void)loginView:(FBLoginView *)loginView
handleError:(NSError *)error{
NSString *alertMessage = nil, *alertTitle;
// Facebook SDK * error handling *
// Error handling is an important part of providing a good user experience.
// Since this sample uses the FBLoginView, this delegate will respond to
// login failures, or other failures that have closed the session (such
// as a token becoming invalid). Please see the [- postOpenGraphAction:]
// and [- requestPermissionAndPost] on `SCViewController` for further
// error handling on other operations.
if (error.fberrorShouldNotifyUser) {
// If the SDK has a message for the user, surface it. This conveniently
// handles cases like password change or iOS6 app slider state.
alertTitle = #"Something Went Wrong";
alertMessage = error.fberrorUserMessage;
} else if (error.fberrorCategory == FBErrorCategoryAuthenticationReopenSession) {
// It is important to handle session closures as mentioned. You can inspect
// the error for more context but this sample generically notifies the user.
alertTitle = #"Session Error";
alertMessage = #"Your current session is no longer valid. Please log in again.";
} else if (error.fberrorCategory ==
FBErrorCategoryUserCancelled) {
// The user has cancelled a login. You can inspect the error
// for more context. For this sample, we will simply ignore it.
NSLog(#"user cancelled login");
} else {
// For simplicity, this sample treats other errors blindly, but you should
// refer to https://developers.facebook.com/docs/technical-guides/iossdk/errors/ for more information.
alertTitle = #"Unknown Error";
alertMessage = #"Error. Please try again later.";
NSLog(#"Unexpected error:%#", error);
}
if (alertMessage) {
[[[UIAlertView alloc] initWithTitle:alertTitle
message:alertMessage
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil] show];
}
}
- (void)loginViewShowingLoggedOutUser:(FBLoginView *)loginView {
// Facebook SDK * login flow *
// It is important to always handle session closure because it can happen
// externally; for example, if the current session's access token becomes
// invalid. For this sample, we simply pop back to the landing page.
TNLRadioAppDelegate *appDelegate = (TNLRadioAppDelegate *)[UIApplication sharedApplication].delegate;
if (appDelegate.isNavigating) {
// The delay is for the edge case where a session is immediately closed after
// logging in and our navigation controller is still animating a push.
[self performSelector:#selector(logOut) withObject:nil afterDelay:.5];
} else {
[self logOut];
}
}
- (void)logOut {
[self.navigationController popToRootViewControllerAnimated:YES];
}
Cqan any one help???
It sounds like you're accessing your FBSession instance from more than one thread. Check that you're not calling [FBSession activeSession] or anything similar from a background thread (or that you're always calling it from the same background thread).