Coder Social home page Coder Social logo

kylebrowning / waterwheel.swift Goto Github PK

View Code? Open in Web Editor NEW
412.0 43.0 93.0 11.06 MB

The Waterwheel Swift SDK provides classes to natively connect iOS, macOS, tvOS, and watchOS applications to Drupal 7 and 8.

License: MIT License

Ruby 2.37% Swift 96.18% Objective-C 0.95% Shell 0.50%
drupal ios watchos macos tvos sdk waterwheel swift

waterwheel.swift's Introduction

Hi there 👋

LinkedIn Twitter Stack Overflow

  • 📱 iOS & Engineering Manager
  • 🥷🏼 Currently Stealth
  • 🪐 Fascinated by space
  • 💻 I publish some open source software on GitHub
  • 🇺🇸 Lives in California

Kyle Browning's github stats

waterwheel.swift's People

Contributors

bhasselbeck avatar darkbreed avatar drewish avatar gitter-badger avatar kylebrowning avatar markdorison avatar markusekblad avatar meste avatar mrmaksimize avatar mrnickel avatar mwatters avatar rollingnet avatar sprhawk avatar tomkremer avatar vivekvpandya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

waterwheel.swift's Issues

user.save function in Drupal IOS SDK fails with "Authentication Needed" error

I am trying to upload a picture for a user. Following is the data i end up sending to Drupal Services using DIOS SDK

Passed arguments:
Array
(
[0] => 13872
[1] => Array
(
[method] => user.save
[data] => Array
(
[picture] => http://mydrupalsite/sites/default/files/user_profiles/picture-13872.jpg
[uid] => 13872
)

[sessid] => bkae6a6kktm3fsonniv4lqe1p1
[uid] => 13872
)

)

The above request fails with an 'Authentication Needed' error.
This call is being made in an admin's context, yet it fails with this error.

I tried using the DIOSExample sample project to test this to update other fields, i get the same error via this sample project.
Spent lot of time tinkering with permissions, different accounts, but could not get it working

Has anybody come across this error earlier?
Any help is appreciated.

Thanks in advance.

My environment details are as follows
Drupal - 6.22
Services - 6.x-3.1
REST Server - 6.x3.1
PList support - 6.x-1.1
DIOS version - Version block mentioned the version as MPL 1.1/GPL 2.0 Don't see any other version string in the downloaded files.

nodeUpdate 401 error

Thanks for all your help, Kyle--what you're saying makes complete sense.

I set up my Drupal site such that I have a webform content type. I, the administrator, created a webform at node X. Anytime an authenticated user (administrator or not) goes to this form, he/she will be able to input data that populates the webform_submitted_data table in my Drupal database. The nid for all the data entries is X (same as node X). No new nodes are created when a user submits his/her webform data at node X. So, if each webform submission doesn't create a new node--and the administrator created the webform at node X--is it even possible for non-adminstrator authenticated users to edit the node (assuming they are not given full permissions for that node)? Of note, I think I have done every possible permission permutation to try to make this happen, including CCK, Content Access module, Nodeaccess module, node specific access grants, etc. And the reason I have gone down the permissions route is that whenever I use nodeGet, I don't get any access errors (nor do I see any of the data that was entered at node X for that user--rather, I see the descriptions for the webform's fields). However, whenever I use nodeUpdate, I get a 401 error--regardless of whether I log in as the administrator or another authenticated (non-administrator) user. Are my permission settings the culprit behind this 401 error? Even if my node permissions for webforms are set correctly, would I still get this error because I'm trying to update a webform submission rather than a node (please see paragraph after sample code below)? What are the correct permissions in order for nodeUpdate to work properly? A sampling of my code is below:

NSMutableDictionary *nodeParams = [[NSMutableDictionary alloc] init];
[nodeParams setObject:@"X" forKey:@"nid"];

[DIOSNode nodeGet:nodeParams success:^(AFHTTPRequestOperation *operation, id responseObject){...--> no access errors; works but returns descriptions for the webform's fields and not any submitted data

[DIOSNode nodeUpdate:nodeParams success:^(AFHTTPRequestOperation *operation, id responseObject){...--> fails with 401 error

I have looked into creating a custom resource per your recommendation. I was going to try to adapt the code in the Services module that already exists for the node resource (update) so that it would update a submission rather than a node. This is based on my suspicion that I need to update a submission since each webform submission results in a new sid but not a new nid (the nid is always X regardless of what the sid is). My suspicion is also based on the fact that nodeGet returns the webform's field descriptions instead of any submitted data. Am I thinking it about all this in the right way?

I thank you in advance for your help and apologize if my question is elementary and/or if anything is unclear. Take care and enjoy the rest of your Thanksgiving holiday!

Potential Memory Leak in DIOSConnect.m

Hello,

First I have to say I love to use DIOS . Good job.

The leak appears after saving a node for two or more times. In my projects and in you DiosDemoProject.

Last week I used instruments(leaks) to get possible memory leaks and it told me that there is a leaked object :
NSCFString 0x5c3eee0 32 CFNetwork HTTPMessage::extractResponseStatusLine(unsigned char const*, long)

Extended Details told me that there is the leaked object has a connection to DiosNode.m:60 , DIOSConnect.m:159 and ASIHTTPRequest.m:762.

So have you ever seen that kind of memory leak ? And what can I do ?

I tried to get rid of the leak , but at the moment I have no idea .

Kind regards from Austria Europe ,
Florian

Build failed: Semantic Issue

Hi,

I've set up a new xcode project and added the AFNetworking library as described and build the project, no issues.

Then I added the drupal-ios-sdk and tried to build the project again. Unfortunately now I get a "Semantic Issue" in DIOSNode.m within the nodeAttachFile in Line 114

"Incompatible block pointer types sending 'void (^)(NSInteger, NSInteger, NSInteger)' to parameter of type 'void (^)(NSInteger, long long, long long)'"

What did I do wrong?

Thanks in advance,
anni

Issue with system.connect on 6.x-3.x

Hi,
great project! I'm using it extensively at the moment.
I've just noticed what may be a bug.

In DIOSConnect.m, ll198-199 and ll 204-205 the plist is accessed for key=#data then key=sessid/user.

Certainly in the Services 3.0-beta2 module, the plist doesn't return with a #data element, so sessid and user are left blank.
I'm using Hugo Wetterberg's REST Server plist module, and not Kyle's/your Plist Server module - perhaps the one wraps the data in #data and the other doesn't?

Threaded comments.

I've noticed that created comments aren't threaded, and have modified my copy to fix this.
Can I submit a patch, or give details somewhere of the fix?

Cheers

Support Request: maintaining a session?

How do I verify if a session is open in Drupal using the DIOS SDK? I don't find it in the documentation. I think that the documentation is also a bit outdated. Thank you.

inherited method and properties not found

In DIOSSession.m I get several warnings

e.g. line 91

[sharedSession setBaseURL:[NSURL URLWithString:url]];

instance method -setBaseURL not found (return type defaults to id)

line 242

NSString *fixedURL = [self baseURLforAddress:url];

some warning but method baseURL...

etc

NodeSave worked... then didn't. Session i think is to blame

Hey Kyle

I've been working with the DIOS SDK some more (thanks for all the help getting me started with it).

I've managed to get my app logging onto the drupal site no problem, i've been able to read a node ID, and i even had it creating a node. This was all without any Authentication though...

So when i checked the Session Authentication tickbox in the services endpoint, i can still log on, but i'm really having no joy creating a session on the click of one button, and then managing to hold on to that session when calling another method - i've tried the examples found in other similar issues in the queue, but no luck.

Can you shed any light on how to work with the Session command, so that we can log on with a session and then use that session to create nodes, etc? Because even once i've logged on - even if i put it all into one method call, it still registers the 'create node' call as anonymous in Drupal's logs.

File.save issue

Hi Kyle,
So bumped into a problem with file.save, when running the operation from iOS, we don't get any data returned, so have no access to the fid and the file doesn't appear to be saved.
Is there something custom in your Services module, other than the Plist Server? We have the file service modules installed.
Using the example app, using the default url (demo.kylebrowning.com) everything works fine, but using our server it doesn't work. So it doesn't appear to be a problem in the iOS code, it's something in the server. We have everything set up as far as I can see described in the readme, and other operations do work (node.save etc).
If there is nothing else custom can you release your module versions?

Many Thanks,
Chris Darke

Cannot create user programmatically on Drupal 7

Using code like:

NSMutableDictionary *newUser = [[NSMutableDictionary alloc] init];
[newUser setObject:@"DrupalUser" forKey:@"name"];
[newUser setObject:@"somepassword" forKey:@"pass"];
[newUser setObject:@"[email protected]" forKey:@"init"];
[newUser setObject:@"[email protected]" forKey:@"mail"];
[newUser setObject:@"1" forKey:@"status"];

[user userSave:newUser];

It says HTTP/1.0 406 Not Acceptable: Username field is required. E-mail address is required. Password field is required.

Using the same forKey values as the above code in PHP code works so I am confident the forKey values are correct.

Views Datasource JSON data

I've been able to successfully login to my Drupal site from within my iOS app--GREAT!!! Additionally, viewGet successfully runs and returns a view for the currently logged in user only--GREAT!!! The data in the returned responseObject is JSON output from views datasource and contains data that I want to use to populate tables in the app.

My question is, how do I extract the data from responseObject? It looks like it's already an array but I don't believe that any key:value pairs have been assigned yet. As such, do I need to create an NSArray and assign key:value pairs using data from responseObject? Or, rather, do I need to create an NSDictionary and assign key:value pairs? Or, do I need to use SBJSON parser to parse the data and then assign key:value pairs into an array or dictionary? Or, am I thinking about it completely incorrectly?

I apologize for the newbie nature of this question and thank everyone in advance for their assistance. If it helps, I have copied the views datasource JSON output that is returned by viewGet's responseObject below:

{"myItems":[{"item":{"uid":"number","sid":"number","itemTitle":"text","itemDate":"shortdate","itemSetting":"text"}}]}

Long story short, I want to create table entries in the app that display:

Top half of table row: "itemDate"
Bottom half of table row: "itemTitle (itemSetting)"

I will use uid and sid to display userID and submission specific node data later.

Again, thank you all in advance for your assistance and enjoy the rest of your weekend!!

Logout errors

When logging out using I'm getting

Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x68855a0 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}

So it looks like services (7.x-3.1) is returning 'null' for http://localhost/api/user/logout which is strange because the code looks like it should be returning 'true'. I wonder if it's pointed at the _user_resource_retrieve callback... I'm not sure if this should be a DIOS bug or services bug yet. It's not logging me out so I'm guessing it's not getting called properly rather than an output issue.

Drupal iOS SDK question (not necessarily an error or problem)

Hello all.

First and foremost, Drupal iOS SDK is awesome and quite a piece of work. With it, I've been able to build an app that enables users to quickly access data they've inputted on my Drupal site from their iOS device (Android coming soon). However, I have developed coder's block and am stuck. Please see below.

Currently, my iOS app allows users to only look at information they've inputted on the Drupal site. I would like to give them the ability to edit the information from the device itself. However, this is challenging because the data on the site is entered using a webform and the view that provides the data for the app is built using webform submitted data. There is no node, that I know of, that contains the data for the view. As such, Drupal iOS SDK's nodeUpdate method isn't helpful. Furthermore, there is no viewUpdate and/or webform_submissionUpdate method, again that I know of, that I can use to enable editing from within the app. Do any of you know of any method or strategy that I could use to enable editing of the Drupal webform submitted data table from within an iOS app? Put another way, any work being done to get a "webformsubmissionUpdate" or "submissionUpdate" method into the Drupal iOS SDK? And, along those lines, any work being done to add a "Submission Update" resource added to the Drupal Services module?

Thank you in advance for your help and have a great day!!!

drupal 7.9 + services 3 fails

Add node doesn't work with above setup, seems that array(0 => array('method' => ..., 'sessid' => ..., 'node' => ...)) is incorrect.
Node must be the only key or whole structure must be flattened. Check services.runtime.inc lines 368 & 393.

To make it work I had to change runMethod by removing other 2 params :

line 149:

// this breaks drupal7+services3, also need to remove method param. Node must be only param sent
//[self removeParam:@"sessid"];
//[self addParam:[self sessid] forKey:@"sessid"];
[self removeParam:@"method"];

Thx for this lib, good work!
M

Storing configuration in Setting.h in a better way

My preferred way of using this library is by checking it out as a git submodule. The problem is that since the Settings.h file is stored in the sub-repo and also included by code in the sub-repo. This sort of tangles things up meaning I ether have to commit my API settings to the sub-repo or just copy all the DIOS files in into my project. I'm guessing you do the later.

I feel like there's got to be a cleaner way to store the API configuration. Perhaps in a .plist file? Maybe stored in the DIOSSession singleton? If it's not hardcoded in file you could do things like change server configuration in response to a UI control changing (say flipping over to a devel server).

Thoughts? You open to this type of a change?

Download Drupal 7 private file

Hi,

Please can somebody tell me how to download Drupal 7 private file with in Objective C?

I can only download public file with NSURLConnection.
Also I implement hook_file_download and I can download private file in browser but I can't download it in Objective C.

Thank

Error on 'nodeAttachFile' in DIOSNode.m

Hi Kyle

OK, don't hate me!

I've attempted to install now with either the Master version, and the Dev version, and both are giving me certain errors, so i'm not sure which to use, and where i'm doing wrong?

So on the Master one, DIOSNode.m throws up an error telling me i'm missing "AFJSONUtilities.h".

That wasn't part of the master version of AFNetworking, so i found that the 'experimental-network-reachability-backgrounding-fix' branch of AFNetworking contained that file, so i added that one to my project instead.

OK, with that file no longer missing, after cleaning, i now get an error on DIOSNode.m, saying:

Incompatible block pointer types sending 'void (^)(NSInteger, NSInteger,NSInteger)' to parameter of type 'void (^)(NSUInteger, long long, long long)'

if i comment that out, i get a million ARC errors on the AFNetworking files. So, back to the Master branch of AFNetworking, and i comment out the #import "AFJSONUtilities.h" line in DIOSNode.m.

So if i go with the Master version of AFNetworking, and comment out these lines of 'nodeAttachFile' in DIOSNode.m:

// [operation setUploadProgressBlock:^(NSInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite) {
// NSLog(@"Sent %d of %d bytes", totalBytesWritten, totalBytesExpectedToWrite);
// }];

I compile no problem, for now - but all i'm doing is sending a login request. I fear if i try and interact with nodes, my commented out code above is going to come back to haunt me!

So, after all that background, this DIOSNode.m error below:

Incompatible block pointer types sending 'void (^)(NSInteger, NSInteger,NSInteger)' to parameter of type 'void (^)(NSUInteger, long long, long long)'

How serious is this, and is there a proper way to fix this, short of just commenting out the offending lines?

DIOSNode.m has an incompatible parameters to setUploadProgressBlock:

from line 113 in DIOSNode.m

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
  [operation setUploadProgressBlock:^(NSInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
    NSLog(@"Sent %qi of %qi bytes", totalBytesWritten, totalBytesExpectedToWrite);
  }];

should change the "long long" var type of the block to "NSInteger", which is same to the definition of - [AFHTTPRequestOperation setUploadProgressBlock:success:failure]

Adding file to a node?

Hi Kyle,

I haven't been able to figure out how to add a file to a node via node.save. We have added an image field (type file) and a credit field (type text) to a node, and I can't figure out how to edit them with the drupal-ios-sdk.

I don't think there is an example of this in the example app. I've seen some examples online using php with arrays, but it doesn't seem to work on iOS.

Do you have an example of adding the uploaded file (in the example app) to a node?

Thanks!
Thomas B.

Blocking Operation

Hi Guys,

First off great job, this seems really cohesive and much nicer than the previous one based on ASI.

Had a question though.. Seems like the request callbacks tend to spin off into different threads. But what if I want to issue a request that I want to wait to finish until executing the next steps?

Thanks again!

DIOSUser userLogoutWithSuccessBlock always receiving failure

When I call the following class method:

[DIOSUser userLogoutWithSuccessBlock:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"logout success %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"logout failed: %@", operation);
}];

The session on Drupal database is destroyed, the user is logged out (everything works as expected), but the block that runs, it's always the failure block despite the logout being successful or not.

Is this a know issue?

DIOSconnect error

Hello,

thanks for Dios it's realy nice work.

I'm using:

Services 6.x-2.4
DIOS 6.x-2.x

in after logout session will be null and if user login again program will crash cuz session is null

error in DIOSConnect.m line 197

        [self setSessid:[[plist objectForKey:@"#data"] objectForKey:@"sessid"]];
        [self setUserInfo:[[plist objectForKey:@"#data"]objectForKey:@"user"]];

my logout function is:

   DIOSUser *user = [[DIOSUser alloc] initWithSession:[delegate session]];
    [user logout];

    if ([[user connResult] objectForKey:@"#data"]) {
        [delegate setSession:user];
    }

    NSLog(@"logout: data %@",[[user connResult] objectForKey:@"#data"]);

 [user release];

the output for nslog is
2011-07-28 12:27:12.443 sorti[5327:b303] logout: data 1

thanks

userLoginWithUsername won't compile in xcode

Hello--I realize that I'm likely asking a newbie question. Hopefully, you guys will remember what it was like to start out and provide some guidance. As a bit of background, I've built my Drupal 6 site and am now trying to build an iOS app so that users can login and see their info using the views I've created. I've built my app framework and am now working on the ability to login from within the app. I am using Xcode (obviously), Drupal-iOS-SDK, and AFNetworking. I have added the following code to my ViewController.m file:

  • (IBAction)login:(id)sender {
    DIOSUser *user = [[DIOSUser alloc] init];
    [user userLoginWithUsername:@"userName" andPassword:@"password"]; //this line won't compile
    }

Unfortunately, the line commented above won't compile--I keep getting the error message, "No visible @interface for DIOSUser declares the selector 'userLoginWithUsername:andPassword:'. I have imported "DIOSUser.h" and the line above the problematic line compiles just fine. Additionally, I have checked DIOSUser.h and DIOSUser.m to make sure the 'userLoginWithUsername..." method is declared.

DIOSUser.h:

  • (void)userLoginWithUsername:(NSString *)username andPassword:(NSString *)password
    success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
    failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;

DIOSUser.m:

  • (void)userLogin:(NSDictionary *)user
    success:(void (^)(AFHTTPRequestOperation *operation, id responseObject)) success
    failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure {
    [self userLoginWithUsername:[user objectForKey:@"name"] andPassword:[user objectForKey:@"pass"] success:success failure:failure];
    }

Again, I realize that this might be an elementary question but everybody has to start somewhere. I thank you in advance for your help. Take care and have a great day!

Sincerely,

DoctorDrupal

Assign the responseObject from DIOSNode nodeGet to a variable

Hi Kyle

I hope you can help - i'm trying to understand how i can utilize the result retrieved by DIOSNode elsewhere in my code.

I am doing a very simple DIOSNode nodeGet as per the example, and it is working successfully; within the "[DIOSNode nodeGet:nodeData success" block of code i can access all the data of the Node that's been retrieved, but i now need to use this data elsewhere in my app - so i need to do something like the below - which doesn't work of course:

NSMutableDictionary *nodeData = [NSMutableDictionary new];
NSMutableDictionary *nodeDataReceived = [NSMutableDictionary new];
[nodeData setValue:@"1" forKey:@"nid"];
[DIOSNode nodeGet:nodeData success:^(AFHTTPRequestOperation *operation, id responseObject) {
    // Do Something with the responseObject
responseObject = nodeData;
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
       // error
}];

or perhaps:

nodeDataReceived = [DIOSNode nodeGet:nodeData success:^(AFHTTPRequestOperation *operation, id responseObject) {
    // Do Someth... etc, etc...

Can you guide me as to how to assign this data to a Dictionary or something? The reason being that i have this data retrieved from Drupal, but now need to use it in several places throughout the code, and it would be ideal if i could write the responseObject into a NSDictionary or something that i can access from different Methods and so on?

Hope this makes sense?

Code=1 "I couldnt get a response, is the site down?

Hi,

I got this error, everything is OK but I don't know why there is no responding:

2012-11-18 02:53:43.826 sorti[2188:15203] e error Error Domain=DIOS-Error Code=1 "I couldnt get a response, is the site down?" UserInfo=0x1014fce0 {NSLocalizedDescription=I couldnt get a response, is the site down?}

Please help me

Error 406 when Session Authentication enabled

Hello.

First, thank you for the tremendous work that you put into building and developing Drupal-iOS-SDK. It is an amazing piece of work and I am impressed by its power daily.

Second, as a bit of background, I am writing an iOS app that allows users to login to my Drupal site with their iPhone/iPad and access their inputted data currently stored/displayed in Views.

Now, to my question/problem. So far, I have been able to successfully login to my Drupal site with the iOS app with OAuth and Session Authentication switched to off. However, as soon as I enable Session Authentication, I get a 406 error. I have tried looking online for a solution but, unfortunately, I have been unable to do so. What could be causing this problem and how would you recommend that I go about trying to resolve it?

On a similar note, my hypothesis is that disabling Session Authentication is what is causing me to get a 401 error when trying to get the app to display the views I've created. Could that be the case? Will resolving my issue above so that I can enable Session Authentication then allow me to access the views?

Thank you in advance for your help and have a great day!

Sincerely,

doctorDrupal

Problems with ASI-HTTP and ARC in iOS 5

I was wondering whether there were any plans to upgrade the use of ASI-HTTP in this code as if you read the posts here http://allseeing-i.com/ the maintainer of ASI-HTTP is not going to continue develop.

Also, if you do try to compile ASI-HTTP using ARC in iOS 5 you will receive a stack of problems. There are workarounds for this, but seeing as though ASI-HTTP is not going to be developed anymore, is there any intention of upgrading to new APIs in iOS 5?

session trouble

I'm trying to create an app that should be accessible only to logged users. Everything I tried works fine, but I can't figure out how to properly access the session once the user log in with the app. As a result I have to delete the app or the second login attempt fails with 406 http error. So my question is: what is the best way to "save" the logged session and reuse it later? (That should be connected to the question: how to properly detect if a user is already logged?)
I'm using the latest dev and [DIOSSession sharedSession] is not working as I expect and gives me back a nil object.

No visible @interface for 'DIOSUser' declares the selector 'initwithDelegate:'

Hi All

i have found and installed the right libraries of AFNetworking and DIOS-SDK that don't give me 'retain' and 'release' errors when building for iOS5 / iOS 6 (so one that works with ARC), and it's now compiling fine, however, when i try and use of of the example code from the documentation page, for example:

DIOSUser *user = [[DIOSUser alloc] initWithDelegate:self]; [user userLoginWithUsername:@"myusername" andPassword:@"mypassword"];

I get an error on the first line, which states:

No visible @interface for 'DIOSUser' declares the selector 'initwithDelegate:'

Any ideas what this is due to? I've been googling and it seems to come back to instance methods and class methods?

Encountered unknown tag HTML on line 5

Hello,

My app was working fine, but now I'm face this problem when conntect there is no error exit this error:

Encountered unknown tag HTML on line 5

also we installed Varnish in our drupal site.

do you have any idea about?

Can't save the node

Hello~

I follow the Demo Setup's video, when I save the node. Appear error message... : Node type is required.

What should I do?

Thanks.

Authenticated calls

Hello,

Sorry if this is not the proper place to put this question,..

I've started using this library. Want to thank you for your amazing job in this project.

I have all nodes of my Drupal 7 accessible only to authenticated users. I'm able to connect and login using this sdk but I can't get the nodes because of an authentication issue.

I wonder if someone could help me with this pseudo-code so I can get nodes from my drupal installation via authenticated calls.

DiosConnect * session = [[DiosConnect alloc] init];

DiosUser * user = [[DiosUser alloc] initWithSession:session];

id response = [user loginWithUsername:@"admin" andPassword:@"myPassword"];

// I get a good response here

DiosNode * nodeController = [[DiosNode alloc] initWithSession:session];

id nodesList = [nodeController nodeGetIndex];

// I get a null list of nodes and an Authentication needed log message

Thanks very much!!

Jordi

Logout error ?

I'l trying to use log out function with the last drupal iOS sdk library and i received this error :

Error Domain=JKErrorDomain Code=-1 "Unexpected token, wanted '{', '}', '[', ']', ',', ':', 'true', 'false', 'null', '"STRING"', 'NUMBER'." UserInfo=0x30dde0 {JKAtIndexKey=0, JKLineNumberKey=1, NSLocalizedDescription=Unexpected token, wanted '{', '}', '[', ']', ',', ':', 'true', 'false', 'null', '"STRING"', 'NUMBER'.}

How to resolve it ?

Thanks

Why viewGet return only 10 items.

Hello,

Please, can some one tell me why viewGet return only 10 items even in DpQuestions project?
It's there a setting that I miss?
NB : My view contains more than 10 items.

Thank

views don't accept contextual filters

Hi,

is it possible to add contextual filters to a views call? I tried this:

DIOSView *stationsView = [[DIOSView alloc] init];
NSMutableDictionary *stationsParams = [NSMutableDictionary new];

        [stationsParams setValue:@"stations" forKey:@"view_name"];
        NSString *nid = [theGuide.details.data valueForKey:@"nid"];
        [stationsParams setObject:[NSArray arrayWithObject:nid] forKey:@"args"];
        [stationsParams setValue:@"default" forKey:@"display_id"];

        [stationsView viewGet:stationsParams success:^(AFHTTPRequestOperation *operation, id responseObject) { 

but it doesn't work! Is there any solution?

No JSON parsing functionality available

Hi,

on some devices an error like
"NSInternalInconsistencyException: No JSON parsing functionality available
Msg: Crash!"

produces a crash. I don't know why this happens or what I can do to stop this.

Any ideas?

Why use instance methods instead of class methods?

I'm curious about the choice of implementing all the methods on say DIOSUser as instance methods rather than class methods, especially since the instances have no properties. In PHP I guess I'd be asking why you didn't make these static functions.

To login you need to initialize an unnecessary object:

 DIOSUser *user  = [[DIOSUser alloc] init];

Before you can call the method:

[user userLoginWithUsername:name andPassword:pass ... ];

But then you ought to be calling release when you're done with it:

[user release];

But if these were class methods you could just do:

[DIOSUser userLoginWithUsername:name andPassword:pass ...];

And in that case you could remove the redundant "user" prefix from the method name... which might be okay since this would break backwards compatibility.

Update body of node not work

I added à node on my site and everything work but when
I'm trying to update the node and if i can update the title, the body does not update.
Why ?

Why viewGet return only 10 items.

Hello,

Please, can some one tell me why viewGet return only 10 items even in DpQuestions project?
It's there a setting that I miss?
NB : My view contains more than 10 items.

Thank

node nodeAttachFile:fileData --- How to assign a role to a user

Hi Kyle, thanks for all your work.

I was wondering how I could get my hands on [node nodeAttachFile:fileData]? I am wanting to attach pictures to nodes. This method is in the docs but nowhere to be found on git branches. I've seen you called it in a commented test which makes me think you have it implemented on your local copy.

Also, is it possible to set a role for a user?

I've tried the following which does not work:

NSMutableDictionary *userData = [NSMutableDictionary new];
NSString *drupalID = [[NSUUID UUID] UUIDString];
NSLog(@"drupalID: %@", drupalID);
NSString *drupalPassword = @"password";
[userData setValue:drupalID forKey:@"name"];
[userData setValue:[drupalID stringByAppendingString:@"@gmail.com"] forKey:@"mail"];
[userData setValue:drupalPassword forKey:@"pass"];

[DIOSUser userRegister:userData success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"register user success");
    NSLog(@"%@", responseObject);
    [[NSUserDefaults standardUserDefaults] setObject:[responseObject objectForKey:@"uid"] forKey:@"kDrupalUserID"];
    [[NSUserDefaults standardUserDefaults] setObject:drupalID forKey:@"kDrupalUserName"];
    [[NSUserDefaults standardUserDefaults] setObject:drupalPassword forKey:@"kDrupalPassword"];
    [userData setValue:[responseObject objectForKey:@"uid"] forKey:@"uid"];
     [userData setObject:@{@"2" : @"authenticated user", @"5" : @"app user"} forKey:@"roles"];
     [DIOSUser userSave:userData success:^(AFHTTPRequestOperation *operation, id responseObject) {
     NSLog(@"success adding role");
     } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
     NSLog(@"failure adding role:%@", [error localizedDescription]);
     }];

Howto login with email/password ?

Hello,

I've already used username/password method (DIOSUser.userLoginWithUsername) to log in Drupal services.
Please, can you tell me how to log in with email/password ?

Thank

file.save response fail

When trying to upload a new file to Drupal with services 6.x 3.x,
the obtained response is not a property list and fails conversion from NSData to NSDictionary

Error Domain=DIOS-Error Code=1 "Encountered unknown tag br on line 1" UserInfo=0x11fb9d0 {NSLocalizedDescription=Encountered unknown tag br on line 1}

trying to print the received response as ASCII NSString:

Printing out response as ASCII text: è!�>�

the DIOSFile and DIOSConnect is original, not modified from github latest version.
the code for the file upload is very similar to the one that can be found on DIOSExample code.

User.save function in Drupal IOS SDK does not save user picture

When saving user picture using the userSave method, the method returns success, but the picture field is not updated. No warnings appear in the services diagnostic logs.

I am trying to pass the uploaded picture's URL to the picture field (complete path, relative path) , but no luck.
Email ID field updates are reflected correctly.

Saw a similar post on drupal.org - http://groups.drupal.org/node/124584#comment-733769
Seems like an old post, but no solution as yet.

The parameters passed in are seen in the drupal logs as follows -

[0] => 13872

   [1] => Array
       (
           [method] => user.save
           [data] => Array
               (
                   [name] => username
                   [picture] => http://mydrupalsite/sites/default/files/user_profiles/picture-13872.jpg
                   [uid] => 13872
                   [mail] => [email protected]
               )

           [sessid] => hk951sjiq22ibf1iu1dt71rsu0
           [uid] => 13872
       )

Drupal Version 6.22
DIOS Ver - MPL 1.1/GPL 2.0

Any help is truly appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.