Using Drupal Services and DIOS SDK for setting user picture in iOS app


I'm trying to set a user picture (fid) for a user after successfully uploading a photo using Drupal services and DIOS SDK. I upload the file using the "fileSave" method of DIOS SDK (DIOSFile). Services then returns an "fid" for the user picture that was just uploaded. When I try to set the fid for the user picture field for the user who is currently logged in, it doesn't get set. There is no error, it actually returns successfully, but if I check on the "picture" field in the users table of the database, nothing is set. I can update other data that is attached to a user such as username, email, password and other custom fields so I don't think it's a permission issue.

I've tried the following code and many variations of it, but nothing seems to updated the "picture" field.

_userUpdateParams = [NSMutableDictionary new]; NSString *fid = @"22"; //For demonstration purposes, I'm hard-coding an fid value. if (username) [_userUpdateParams setValue:username forKey:@"name"]; if (password) [_userUpdateParams setValue:password forKey:@"current_pass"]; if (newPassword) [_userUpdateParams setValue:newPassword forKey:@"pass"]; if (email) [_userUpdateParams setValue:email forKey:@"mail"]; if (fid) [_userUpdateParams setValue:fid forKey:@"picture"]; if (uid) [_userUpdateParams setValue:uid forKey:@"uid"]; [DIOSUser userUpdate:_userUpdateParams success:^(AFHTTPRequestOperation *operation, id responseObject) { ... } failure:^(AFHTTPRequestOperation *operation, NSError *error) { ... }];

This post suggested to use the "fid" of the file: <a href="https://github.com/kylebrowning/drupal-ios-sdk/issues/28" rel="nofollow">https://github.com/kylebrowning/drupal-ios-sdk/issues/28</a>


First of all i have created a user in drupal with a userProfile related (with PID).

Than i have used this method with 3 parameters:

nameEntity = name of entity drupal to update;

fid = you know what this mean;

entityID = id of entity to update;

finally update the entity!

works for me:

+ (void)updateEntityUserProfileWithName:(NSString*)nameEntity andImageFid:(NSString*)fid eid:(NSString*)entityID success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure{ ToPartyUserProfile *user=[ToPartyUserProfile sharedManager]; NSMutableDictionary* entityData = [NSMutableDictionary new]; [entityData setObject:entityID forKey:@"pid"]; [entityData setObject:@"main" forKey:@"type"]; [entityData setObject:@{@"und": @[@{@"value": [user nickname]}]} forKey:@"field_nickname"]; [entityData setObject:@{@"und": @[@{@"value": [user gender]}]} forKey:@"field_sex"]; [entityData setObject:@{@"und": @[@{@"value": [user nationality]}]} forKey:@"field_nationality"]; [entityData setObject:@{@"und": @[@{@"fid": fid}]} forKey:@"field_photo"]; [DIOSEntity entityUpdate:entityData name:nameEntity eid:entityID success:^(AFHTTPRequestOperation *op, id response) { success(op,response); } failure:^(AFHTTPRequestOperation *op, NSError *err) { failure(op,err); }]; }


  • Simple command-line app I/O in Dart
  • How to issue a command that produces infinite output and return immediately
  • How to add System.Windows dll to Visual Studio 2010 express?
  • How to work with Master Page that is attached to the page via the page's basepage?
  • Fire callback when selection was made with select2 4.0, and retrieve the value of last selection
  • Retrieve IP address of device
  • jQuery: add elements until a particular height is reached
  • cygwin cannot exec 'git-add--interactive' permission denied
  • How to revert to previous XCode version?
  • Display images in Django
  • How to set ini file attributes during an Inno install
  • C++ Partial template specialization - design simplification
  • NHibernate Validation Localization with S#arp Architecture
  • Get one-time binding to work for ng-if
  • How can I send an e-mail from a vbs script
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • Display issues when we change from one jquery mobile page to another in firefox
  • Different response to non-authenticated users and AJAX calls
  • Bug in WPF DataGrid
  • Can Jackson SerializationFeature be overridden per field or class?
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Redux, normalised entities and lodash merge
  • How to get next/previous record number?
  • Confusion with PayPal's monthly billing cycle
  • Data Validation Drop Down Box Arrow Disappearing
  • retrieve vertices with no linked edge in arangodb
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • Acquiring multiple attributes from .xml file in c#
  • Understanding cpu registers
  • how does django model after text[] in postgresql [duplicate]
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • embed rChart in Markdown
  • How can I remove ASP.NET Designer.cs files?
  • Add sale price programmatically to product variations
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app
  • java string with new operator and a literal