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

Drupal 7 Swift 3.0 #155

Closed
diogoAntunes opened this issue Aug 28, 2017 · 12 comments
Closed

Drupal 7 Swift 3.0 #155

diogoAntunes opened this issue Aug 28, 2017 · 12 comments

Comments

@diogoAntunes
Copy link

Hey, thank you for all the hard work, I have a little question, I'm trying to use this on a Swift 3.0 project to connect to a server made in Drupal 7, so I'm targeting pod 'drupal-ios-sdk', '~> 2.1' but I can't even import it to the project I'm getting multiple errors:

-DIOSComment.h:38:9: 'AFHTTPRequestOperation.h' file not found

  • Could not build Objective-C module 'drupal_ios_sdk'

A little help on this would be much appreciated :)

@kylebrowning
Copy link
Owner

kylebrowning commented Aug 28, 2017

Hrmm,

It sounds like, s.dependency 'AFNetworking', '~> 2.0' is not getting included, can you try including it yourself.

@kylebrowning
Copy link
Owner

kylebrowning commented Aug 28, 2017

Also Im sorry there isnt a Swift version for Drupal 7. Swift is so much nicer than OBJ-C And Drupal 8 is so much nicer than Drupal 7

@diogoAntunes
Copy link
Author

diogoAntunes commented Aug 28, 2017

Thank you for the quick response :) It is installed:

Installing AFNetworking (2.6.3)
Installing drupal-ios-sdk (2.1.5)

Not sure whats happening :\

Yes tell me about it!

@kylebrowning
Copy link
Owner

OKay so, in your podfile remove, use frameworks!

And create a new objective-c bridging header.

Then in your app delegate you can do [DIOSSession .setupDios(withURL: "http://d7url")]

@kylebrowning
Copy link
Owner

//  DIOS-Bridging-Header.h
//  d7Test
//
//  Created by Kyle Browning on 8/28/17.
//  Copyright © 2017 Kyle Browning. All rights reserved.
//

#ifndef DIOS_Bridging_Header_h
#define DIOS_Bridging_Header_h

#import "DIOSSession.h"
#import "DIOSNode.h"
#endif /* DIOS_Bridging_Header_h */

@kylebrowning
Copy link
Owner

And then be sure to set that in your build settings.
screen shot 2017-08-28 at 2 52 31 pm

@diogoAntunes
Copy link
Author

You are the best Kyle :) Thank you very much for all the help, I really appreciate it 👍

@kylebrowning
Copy link
Owner

kylebrowning commented Aug 28, 2017

Good luck, theres a good chance this stuff doesnt work in Swift with DOIS 2.1~, but I just tested it with the plist file, and everything worked!

2017-08-28 15:01:31.262 d7Test[8721:605505] options that were found and set : {
    aliasComment = comment;
    aliasFile = file;
    aliasNode = node;
    aliasSystem = system;
    aliasTaxonomyTerm = "taxonomy_term";
    aliasTaxonomyVocabulary = "taxonomy_vocabulary";
    aliasUser = user;
    aliasViews = views;
    endpoint = api;
    "oauth_consumer_key" = yTkyapFEPAdjkW7G2euvJHhmmsURaYJP;
    "oauth_token" = ZzJymFtvgCbXwFeEhivtF67M5Pcj4NwJ;
    siteUrl = "http://local.drupal7.com";
}

@diogoAntunes
Copy link
Author

Btw @kylebrowning quick last question, does this version of the library support 3-legged oAuth?

@kylebrowning
Copy link
Owner

@diogoAntunes Yup, you can see an example of that here, https://github.com/kylebrowning/drupal-ios-sdk-example/blob/master/Drupal%20Questions/WHAppDelegate.m#L72

@diogoAntunes
Copy link
Author

@kylebrowning sorry to disturb you again and on a closed issued :( I was following your example on https://github.com/kylebrowning/drupal-ios-sdk-example/blob/master/Drupal%20Questions/WHAppDelegate.m#L72

But I'm getting a crash when doing the initial DIOS setup on:

DIOSSystem.m: line 52 - [[DIOSSession sharedSession] setUser:[responseObject objectForKey:@"user"]];

Because basically what the server is sending is this:

oauth_token=7SCGUQvqZp5LrqhWeX8BZGDSw4MeQkLJ&oauth_token_secret=2BjJ6XiWtQS4rU5TuxdN44DxEX445Y6X

It's not even a proper dictionary. So my question is, this not an expected behaviour on the oAuth Flow, or I can discard that line? :(

@kylebrowning
Copy link
Owner

Im not sure why the server is sending that response for a system/connect call. It shouldnt be.

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

2 participants