logo
down
shadow

A solution for my issue with sending some info from an array to Parse


A solution for my issue with sending some info from an array to Parse

By : Atr
Date : November 22 2020, 10:38 AM
help you fix your problem If you need to support more than one instance of each type of product, then you should probably restructure your charge params dictionary to support arrays. It's common in commerce systems to have the concept of a "line items", which would be a set of items in the order. For each of the line items, you could have a line_item_type, and a dictionary of type_attributes which would differ based on the line_item_type. This way, you can capture the specific attributes of your accessories and bikes, but in a generic line_item structure.
A structure that resembles something like below should work for what you're after. This example has 2 bike items and 1 accessory.
code :
{ "token": token.tokenId,
  "currency": "usd",
  "amount": result,
  "line_items": [
    { "line_item_type": "bike",
      "line_item_attributes": {
        "bikeName": self.bikeName,
        "bikeSize": self.bikeSize,
        "bikeHasRearBrake": [NSNumber numberWithBool:self.bicycleHasRearBrake],
        "bikeColor": self.bikeWheelSetColor,
        "bikeExtraWheelset": self.bikeExtraWheelset,
        "bikeQty": [self.bikeQty stringValue]
      }
    },
    { "line_item_type": "bike",
      "line_item_attributes": {
        "bikeName": self.bikeName,
        "bikeSize": self.bikeSize,
        "bikeHasRearBrake": [NSNumber numberWithBool:self.bicycleHasRearBrake],
        "bikeColor": self.bikeWheelSetColor,
        "bikeExtraWheelset": self.bikeExtraWheelset,
        "bikeQty": [self.bikeQty stringValue]
      }
    },
    { "line_item_type": "accessory",
      "line_item_attributes": {
        "accessoryName": self.accessoryName,
        "accessoryQty": [self.accessoryQty stringValue],
        "accessoryColor": self.accessoryColor,
        "accessorySize": self.accessorySize
      }
    }]
}
NSMutableArray *lineItems = [NSMutableArray new];
Cart *cartObject = [Cart sharedManager];
for (id object in cartObject.cartArray) {
  if ([object isKindOfClass:[ChosenBike class]]) {
    ChosenBike *bikeObject = (ChosenBike *)object;
    NSDictionary *attributes = @{@"bikeName": bikeObject.chosenName, 
                                 @"bikeSize": bikeObject.chosenSize, 
                                 @"bikeHasRearBrake": @(bikeObject.bicycleHasRearBrake), 
                                 @"bikeColor": bikeObject.chosenWheelSetColor, 
                                 @"bikeExtraWheelset": bikeObject.extraSeriesWheelset, 
                                 @"bikeQty": [bikeObject.extraSeriesWheelset stringValue]};
    NSDictionary *lineItem = @{@"line_item_type": @"bike",
                               @"line_item_attributes": attributes};
    [lineItems addObject:lineItem];
  } else if ([object isKindOfClass:[ChosenAccessory class]]) {
    ChosenAccessory *accessoryObject = (ChosenAccessory *)object;
    NSDictionary *attributes = @{@"accessoryName": accessoryObject.chosenName, 
                                 @"accessoryQty": [accessoryObject.chosenQuantity stringValue], 
                                 @"accessoryColor": accessoryObject.color, 
                                 @"accessorySize": accessoryObject.chosenSize};
    NSDictionary *lineItem = @{@"line_item_type": @"accessory",
                               @"line_item_attributes": attributes};
    [lineItems addObject:lineItem];
  }
}

NSDictionary *chargeParams = @{@"token": token.tokenId,
                               @"currency": @"usd",
                               @"amount": result, 
                               @"line_items": lineItems};


Share : facebook icon twitter icon
Parse main.js Mandrill HTML mail sending issue

Parse main.js Mandrill HTML mail sending issue


By : Yuval Tassa
Date : March 29 2020, 07:55 AM
may help you . You might be experiencing side effects from a text encoding issue. The Mandrill SDK on parse doesn't appear to handle the charset you're using. Take a look at this post from their forums that offers a workaround for that problem.
https://www.parse.com/questions/sometimes-getting-mandrill-you-must-specify-a-key-value-error-when-sending-email
How to retrieve object info and add it to an array with Parse.com/Express JS

How to retrieve object info and add it to an array with Parse.com/Express JS


By : RogerG
Date : March 29 2020, 07:55 AM
may help you . So it turns out JS has .url() which saves me a lot of headache.
I simply used:
code :
var holder = videoResults[i].get("userVid");    
videoURL[i] = holder.url();
Getting Parse info from a saved Array?

Getting Parse info from a saved Array?


By : Softcyd
Date : March 29 2020, 07:55 AM
wish of those help I got it. I simply ran the query for user since the only objects one user should have would be vids 1 - 10. Then I ran a for loop for the items with strings equal to vid1 - vid10. Finally I created public arrays in this view controller and appended them with each element. Here's my code.....
code :
let query = PFQuery(className: "UserVideos")
        query.whereKey("userObjectId", equalTo: PFUser.currentUser()!.objectId!)
        query.findObjectsInBackgroundWithBlock { (vid:Array?, error:NSError?) -> Void in
            if !(error != nil)
            {
                //print(vid!)
                for items in vid!
                {

                    if let myfav1 = items["vid1"] as? NSArray
                    {
                        let id = myfav1[0] as! String
                        let title = myfav1[1] as! String
                        let description = myfav1[2] as! String
                        let image = myfav1[3] as! String
                        self.vidRankArray.append(1)
                        self.vidIdArray.append(id)
                        self.vidTitleArray.append(title)
                        self.vidDescriptionArray.append(description)
                        self.vidImageArray.append(image)
                    }
Sending cell info from one view controller to another Swift and Parse

Sending cell info from one view controller to another Swift and Parse


By : donatus
Date : March 29 2020, 07:55 AM
should help you out
VC1
code :
//PUT THIS IN THE FIRST VC CLASS
var appUserResult: PFUser?

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

    //TAKE OUT LET - YOU'VE ALREADY DEFINED AS CLASS VAR
    appUserResult = appUsers[indexPath.row]

    print(appUserResult)
    self.performSegueWithIdentifier("openVC2", sender: self)
}

func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
   if segue.identifier == "openVC2" {
    let indexPath = self.resultsPageTableView.indexPathForSelectedRow!

//INDEXPATH ISN'T AVAILABLE IN PREPAREFORSEGUE
//let userToShow = appUsers[indexPath.row]

let newVc = segue.destinationViewController as! UserProfileDetailsViewController
  //USE THE CLASS VARIABLE TO PASS
  newVc.userToShowDetail = appUserResult
var userToShowDetail: PFUser?
Can we create users in Keycloak by sending a json array containing more than 2 user info?

Can we create users in Keycloak by sending a json array containing more than 2 user info?


By : Khellaf ABDESSLAM KH
Date : March 29 2020, 07:55 AM
I wish this help you After checking Keycloak's REST API doesn't look like bulk/batch requests for creating users are accepted. The only solution would be to send the POST request for every user.
This is not surprising, HTTP is not prepared for this kind of requests:
Related Posts Related Posts :
  • Convert from NStimeInterval to CMTime accurately
  • How can I continue my count from the correct spot once I load the saved count?
  • instance method 'connect:' not found (return type defaults to 'id'
  • Does an object initialize automatically if it is the synthesized property of another object?
  • What reasons are there to pass an argument to an initializer in objective C?
  • NSLogging UILabel's text outputs null
  • undefined reference to '__objc_class_name_Fraction'
  • Move UIView above UITableView when user Scrolls Down
  • adding object to nsmutablearray with custom delegate function giving error
  • Cocoa editing NSBezierPath
  • Perform a action on specific time using Parse
  • Objective-C: How to convert json value to BOOL?
  • How to make an int counter for the days
  • Assigning Label Value with Selected Table View Cell
  • SpriteKit - Preloader using GCD
  • Can dependency injection like Typhoon replace multiple singletons?
  • Objective C - How to determine if a folder is a package?
  • How can one draw a background in the elastic portion of an NSScrollView?
  • Swift Extension fails adding overloaded methods to Objective-C class
  • Determine if key is incorrect with CCCrypt kCCOptionPKCS7Padding-Objective C
  • PQgetResult always returns NULL
  • self.navigationController? is nil when pushing from a objective-c viewController to a Swift ViewController
  • Where to add subViews that I want floating in an NSScrollView using AutoLayout?
  • 'User' in 'User-defined classes'
  • How to get value of a key in NSDictionary?
  • Adding Border Line to UITableView in StoryBoard
  • Mac App Storyboard - Access Document in NSViewController
  • Objective c, reposition a view above the keyboard in one single animation
  • Dismiss modal segue
  • Error message is saying my data is NULL - NSKeyedUnArchiver - I've followed all the steps - still won't work
  • Remove apostrophe in CFStringTransform results
  • Label showing wrong values while NSLog shows the right ones in SpriteKit
  • How to work with locally modified Cocoapod which don't include podspec?
  • What does kCGWindowSharingState actually do?
  • It is possible to copy a CFTypeRef?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org