Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot compile with xcode 7 beta #1

Closed
ihomecall opened this issue Aug 27, 2015 · 26 comments
Closed

cannot compile with xcode 7 beta #1

ihomecall opened this issue Aug 27, 2015 · 26 comments

Comments

@ihomecall
Copy link

Nice job. Many guys are looking for this porting. Thanks. I just googled yesterday and could not find. and today, I found it -:)

I had compiling issue:
ld: framework not found FacebookSDK for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

there are several other bugs that I commented out.

Have you been able to compile?

@kwkhaw
Copy link
Collaborator

kwkhaw commented Aug 27, 2015

Hi ihomecall,
May I know which beta version are you using? I was using beta 5.
Did you encounter any error when running "pod install"?

Yeah, I was able to compile with Xcode beta 5.

On 27 Aug 2015, at 12:29 pm, ihomecall notifications@github.com wrote:

Nice job. Many guys are looking for this porting. Thanks. I just googled yesterday and could not find. and today, I found it -:)

I had compiling issue:
ld: framework not found FacebookSDK for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

there are several other bugs that I commented out.

Have you been able to compile?


Reply to this email directly or view it on GitHub.

@ihomecall
Copy link
Author

I am using Version 7.0 beta 6 (7A192o)
I download the package. run pod install, and then compile. got the following errors:

error: remove /Users/xxx/Library/Developer/Xcode/DerivedData/SwiftAnyPic-bcjrjwjkxdytkqefhstwkmzclufd/Build/Products/Debug-iphonesimulator/Pods-SwiftAnyPic/FormatterKit.framework/ca.lproj: Directory not empty

error: make directory /Users/xxx/Library/Developer/Xcode/DerivedData/SwiftAnyPic-bcjrjwjkxdytkqefhstwkmzclufd/Build/Products/Debug-iphonesimulator/Pods-SwiftAnyPic/FormatterKit.framework/ca.lproj: File exists

could you try with beta6?

@kwkhaw
Copy link
Collaborator

kwkhaw commented Aug 27, 2015

I just installed Xcode 7 beta 6. Yeah, I got 3 errors during the compilation.
But I didn't encounter the 2 issues that you mentioned.
By the way, do you still see the 1st issue?
ld: framework not found FacebookSDK for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

@ihomecall
Copy link
Author

this is the current error:
error: make directory /Users/jianjunh/Library/Developer/Xcode/DerivedData/SwiftAnyPic-bcjrjwjkxdytkqefhstwkmzclufd/Build/Products/Debug-iphonesimulator/Pods-SwiftAnyPic/FormatterKit.framework/ru.lproj: File exists

This error is caused by this warning

Warning: Multiple build commands for output file /Users/jianjunh/Library/Developer/Xcode/DerivedData/SwiftAnyPic-bcjrjwjkxdytkqefhstwkmzclufd/Build/Products/Debug-iphonesimulator/Pods-SwiftAnyPic/FormatterKit.framework/es.lproj

@ihomecall
Copy link
Author

It seems the error comes from this file

Pods/Target\ Support\ Files/Pods-SwiftAnyPic/Pods-SwiftAnyPic-frameworks.sh

@ihomecall
Copy link
Author

this below error is gone
ld: framework not found FacebookSDK for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

@kwkhaw
Copy link
Collaborator

kwkhaw commented Aug 29, 2015

hmm... I'm not sure if it is related to these issues.
CocoaPods/CocoaPods#3288
https://github.com/mattt/FormatterKit/issues/158

I guess this is probably FormatterKit or Cocoapods issue.

By the way, I'm using:

- Mac OS X: Yosemite (10.10.4).
- Xcode: Version 7 beta 6
- Cocoapods: 0.38.2

What about yours?

Have you tried to clean (Clean the build folder: Option + Cmd + Shift + K) and rebuild?

I wonder if there is anyone else (other than me) has tried and compiled successfully, then probably we can check if this is caused by the environment.
Haha... may be so far you are the first and only one who has cloned and compiled. 😛
Sorry, I know it is quite frustrating. 😞

In the meantime, I will evaluate if I can replace FormatterKit with other alternative.

@kwkhaw
Copy link
Collaborator

kwkhaw commented Aug 30, 2015

Hi @ihomecall , I created a dummy xcode project to see if you have any problem with environment with the FormatterKit. https://github.com/kwkhaw/formatterkitSampleApp
Please run pod install, and run the formatterkitSampleApp.xcworkspace.

Kindly let me know if you encounter the same issue as you did in SwiftAnyPic.
Thanks. :-)

@ihomecall
Copy link
Author

hi, kwkhaw. I just downloaded the dummy project. did pod install. and still get the exact same error

error: make directory /Users/jianjunh/Library/Developer/Xcode/DerivedData/formatterkitSampleApp-bqqyfpmwozhqloaceflmpchpeyed/Build/Products/Debug-iphonesimulator/Pods-formatterkitSampleApp/FormatterKit.framework/ca.lproj: File exists
''

@kwkhaw
Copy link
Collaborator

kwkhaw commented Aug 30, 2015

I see. Please provide me the version of your:

  • Mac OSX
  • Xcode (should be Xcode 7 beta 6?)
  • cocoapods

@ihomecall
Copy link
Author

mac os 10.10.5 (14F27)
Xcode 7 beta 6
pod --version
0.36.3

@kwkhaw
Copy link
Collaborator

kwkhaw commented Aug 31, 2015

Is it possible for you to upgrade your cocoapods version to 0.38.2 or latest and try again?

@ihomecall
Copy link
Author

Hi, buddy! I just tried before saving your post. It works! finally, I can compile the SwiftAnypic. Thanks...
the facebook login is not working. did ur work?

Keep moving. Buddy. Your contribution is a well-waited one for the parse community....
I will actually build an app based on it. So I hope u can make it stable -:)

@ihomecall
Copy link
Author

maybe you can modify the readme to alert users to install cocopods 0.38.2.

@kwkhaw
Copy link
Collaborator

kwkhaw commented Aug 31, 2015

Yeah, sounds great!
May I know what is the error that you observed when logging in with facebook? I need more details. :-)

For me, i can run the app without any major problems. I can login with facebook, post photo, like, add comment, view profile...

On 31 Aug 2015, at 8:36 am, ihomecall notifications@github.com wrote:

Hi, buddy! I just tried before saving your post. It works! finally, I can compile the SwiftAnypic. Thanks...
the facebook login is not working. did ur work?

Keep moving. Buddy. Your contribution is a well-waited one for the parse community....
I will actually build an app based on it. So I hope u can make it stable -:)


Reply to this email directly or view it on GitHub.

@ihomecall
Copy link
Author

The error is when trying to login using facebook
fatal error: unexpectedly found nil while unwrapping an Optional value
(lldb) ''

The error is from this file (this line: let facebookUserId: String = accessTokenData.userID).
func handleFacebookSession() {
if PFUser.currentUser() != nil {
if self.delegate != nil && self.delegate!.respondsToSelector(Selector("logInViewControllerDidLogUserIn:")) {
self.delegate!.performSelector(Selector("logInViewControllerDidLogUserIn:"), withObject: PFUser.currentUser())
}
return
}

    let fbActiveSession = FBSession.activeSession()
    let accessTokenData = fbActiveSession.accessTokenData
    let accessToken: String = accessTokenData.accessToken
    let expirationDate: NSDate = accessTokenData.expirationDate
    let facebookUserId: String = accessTokenData.userID

    // FIXME: check for nil or zero length?
    if accessToken.length == 0 || facebookUserId.length == 0 {
        print("Login failure. FB Access Token or user ID does not exist")
        return
    }

    self.hud = MBProgressHUD.showHUDAddedTo(self.view, animated: true)

    // Unfortunately there are some issues with accessing the session provided from FBLoginView with the Parse SDK's (thread affinity)
    // Just work around this by setting the session to nil, since the relevant values will be discarded anyway when linking with Parse (permissions flag on FBAccessTokenData)
    // that we need to get back again with a refresh of the session
    if fbActiveSession.respondsToSelector(Selector("clearAffinitizedThread")) {
        fbActiveSession.performSelector(Selector("clearAffinitizedThread"))
    }

    PFFacebookUtils.logInWithFacebookId(facebookUserId, accessToken: accessToken, expirationDate: expirationDate, block: { (user, error) in
       if error == nil {
           self.hud!.removeFromSuperview()
           if self.delegate != nil {
               if self.delegate!.respondsToSelector(Selector("logInViewControllerDidLogUserIn:")) {
                   self.delegate!.performSelector(Selector("logInViewControllerDidLogUserIn:"), withObject: user)
               }
           }
       } else {
           self.cancelLogIn(error)
       }
   })
}

I tried to compile the obj-c version of anypic, and got similar error, and the fix is this from stackflow
http://stackoverflow.com/questions/28419227/parse-anypic-facebook-userid-is-returning-nil

I was having this same issue when running Anypic on a device and submitted a support ticket with Facebook. They confirmed that it's an issue when signing in with the Facebook application and recommended using PFFacebookUtils logInWithPermissions as a workaround until they're able to look into it further. I changed the handleFacebookSession method within PAPLogInViewController.m to the code below and was finally able to login with a device!

  • (void)handleFacebookSession {
    if ([PFUser currentUser]) {
    if (self.delegate && [self.delegate respondsToSelector:@selector(logInViewControllerDidLogUserIn:)]) {
    [self.delegate performSelector:@selector(logInViewControllerDidLogUserIn:) withObject:[PFUser currentUser]];
    }
    return;
    }

    NSArray *permissionsArray = @[ @"public_profile",
    @"user_friends",
    @"email"];

    self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];

    // Login PFUser using Facebook
    [PFFacebookUtils logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error) {

    if (!user) {
        NSString *errorMessage = nil;
        if (!error) {
            NSLog(@"Uh oh. The user cancelled the Facebook login.");
            errorMessage = @"Uh oh. The user cancelled the Facebook login.";
        } else {
            NSLog(@"Uh oh. An error occurred: %@", error);
            errorMessage = [error localizedDescription];
        }
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Log In Error"
                                                        message:errorMessage
                                                       delegate:nil
                                              cancelButtonTitle:nil
                                              otherButtonTitles:@"Dismiss", nil];
        [alert show];
    } else {
        if (user.isNew) {
            NSLog(@"User with facebook signed up and logged in!");
        } else {
            NSLog(@"User with facebook logged in!");
        }
    

Maybe you can refer to this post

@kwkhaw
Copy link
Collaborator

kwkhaw commented Aug 31, 2015

I see. I got it. I will check it out later.
By the way, did you try with Simulator?

@ihomecall
Copy link
Author

yes. I tried with Simulator rather than iphone or ipad, which are not ios9.0 yet.

@ihomecall
Copy link
Author

I guess you only need to convert the fixing code into swift and the problem should be gone.
not sure why you can run without issues -:)

@kwkhaw
Copy link
Collaborator

kwkhaw commented Sep 1, 2015

Here are the corresponding code in Swift syntax:

func handleFacebookSession() {
        if PFUser.currentUser() != nil {
            if self.delegate != nil && self.delegate!.respondsToSelector(Selector("logInViewControllerDidLogUserIn:")) {
                self.delegate!.performSelector(Selector("logInViewControllerDidLogUserIn:"), withObject: PFUser.currentUser()!)
            }
            return
        }

        let permissionsArray = ["public_profile", "user_friends", "email"]
        self.hud = MBProgressHUD.showHUDAddedTo(self.view, animated: true)

        // Login PFUser using Facebook
        PFFacebookUtils.logInWithPermissions(permissionsArray, block: { (user, error) in
            if user == nil {
                var errorMessage: String = ""
                if error == nil {
                    print("Uh oh. The user cancelled the Facebook login.")
                    errorMessage = "Uh oh. The user cancelled the Facebook login."
                } else {
                    print("Uh oh. An error occurred: %@", error)
                    errorMessage = error!.localizedDescription
                }
                let alert = UIAlertView(title: "Log In Error", message: errorMessage, delegate: nil, cancelButtonTitle: nil, otherButtonTitles: "Dismiss", "")
                alert.show()
            } else {
                if user!.isNew {
                    print("User with facebook signed up and logged in!")
                } else {
                    print("User with facebook logged in!")
                }

                if error == nil {
                    self.hud!.removeFromSuperview()
                    if self.delegate != nil {
                        if self.delegate!.respondsToSelector(Selector("logInViewControllerDidLogUserIn:")) {
                        self.delegate!.performSelector(Selector("logInViewControllerDidLogUserIn:"), withObject: user)
                        }
                    }
                } else {
                    self.cancelLogIn(error)
                }
            }
        })
    }

Can you help to try it out?
I just convert and made sure it compiled, I didn't try to run yet. 😛
Thanks.

@ihomecall
Copy link
Author

hi, kwkhaw! It works. oh yeah. Works perfectly! I can now login in simulator. and post images. thanks for quick update.

there is a minor error in background
2015-09-01 00:38:25.471 SwiftAnyPic[46052:12673326] Bolts bug: setting nil error (their bug): -[BFTask setError:]

I guess now u only need to fix those deprecated function warnings and it becomes a great contribution to help people develop parse platform apps.

@kwkhaw
Copy link
Collaborator

kwkhaw commented Sep 1, 2015

Yeah, that's great! I will merge the code later. If you don't mind to get your hands dirtier (since your hands are already dirty now. :P), please feel free to make any changes or fixes, and create a PR. By the way, I also don't see any new post on the Anypic app using the default Parse client key. So, I guess you are using your own Parse App and Facebook app?
Anyway, if you want to reach me for any discussion which is not really an issue, you may email me at [my username]@gmail.com. Also, I still can't try out Push Notification, as I don't have any "FB friends who are using Anypic". If you are interested to try out the feature using your Parse app, we may try it out. :-)

@ihomecall
Copy link
Author

my facebook username is iclassmade
add me as anypic friend.

@chrischenyc
Copy link

any chance to make this project compiled in Xcode 6?

@kwkhaw
Copy link
Collaborator

kwkhaw commented Sep 9, 2015

@chenyuan I gave it shot, 36 errors... sigh...
I went through the error list... I think not really worth the effort to fix it as Xcode 7 is just around the corner. Sorry, dude.

@chrischenyc
Copy link

that's cool, mate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants