Swift - NSURLSession downloading in background? - ios

I'm creating an iOS app by swift that is as same as the AliExpress iOS app.
This App has ability that connect to our site and download all of data from JSON api online.
Now, I wanna download the images of the icons and banner slider from our site by JSON api in main page. But I don't know how i can do it. Do I use queues or background functions like in android? Also, I'm an android developer and i know how i can do this in android. You can guide me by this way ,too. please guide me by sample codes or description of its logic.

Please refer following link for tutorial
http://www.raywenderlich.com/51127/nsurlsession-tutorial
Apple documentation can be found on following link
https://developer.apple.com/library/prerelease/ios/documentation/Foundation/Reference/NSURLSession_class/
Swift example can be found here
http://jamesonquave.com/blog/making-a-post-request-in-swift/
I have also created a demo for the same
https://github.com/Gagan5278/SessionDownload
Let me know if you want more on this.

You have the seed of your answer in the title of your question. You want to create an NSURLSession and add NSURLDownloadTasks to it. That class does all the work for you.
A quick search on Github reveals this repository that claims to offer an async download queue in Swift:
https://github.com/Gurpartap/Cheapjack
(I haven't used that one. You can either build it into your project or look at the code and use it to implement your own download sessions.)
There is also AlamoFire, another swift library that has built-in JSON support.

Related

How can i upload video to Twitter using IOS

I have a local video link, and i want when the user press the button -> show twitter app with my video and title there (without using UIActivityViewController), just by pressing the button
You have to choose which way you want to go to upload a video, i.e. post a tweet with just that title you've mentioned.
Option 1
Use the HTTP API and create a URLRequest that contains the video as 'attachment'. You have to handle authentication first or the request will most likely fail.
Option 2 (Not really an option anymore)
Another way would be the iOS SDK provided, as given in the other example here. Problem is: there is no longer an official Twitter SDK for iOS. You could try your luck with the archived OpenSource SDK but maintainability is pretty decent with this.

Where do I download FBProfileExpressionKit?

I've read the docs here https://developers.facebook.com/docs/profile-expression-kit/ios/ several times, and I've downloaded the Facebook SDK from here https://developers.facebook.com/docs/ios/downloads. That download doesn't contain the needed FBProfileExpressionKit framework to integrate with the Profile Expression Kit SDK, and the site itself doesn't have a link to download it. Where the heck do I do download FBProfileExpressionKit from?
I searched but there is no option in FBProfileExpressionKit Documentation.
You can download FBProfileExpressionKit from here
You can upload photo and video as follow
[FBSDKProfileExpressionSharer uploadProfilePictureFromData:videoData metadata:nil];
[FBSDKProfileExpressionSharer uploadProfilePictureFromUIImage:uiimage metadata:nil];
More Info
Here's how I wound up doing it (I reverse engineered how the SDK embedded in another app was sending the message to Facebook's app): https://github.com/timonus/TJFacebookProfileExpression.

paymentMethodNonce not called in Braintree Drop-in Payment UI iOS v4

I am new to Braintree SDK. I followed this link https://developers.braintreepayments.com/guides/drop-in/ios/v4 . When I try to generate paymentMethodNonce I am not able to do it. The drop in UI is Displayed but it is not generating paymentMethodNonce. I tried BTDropInControllerDelegate but those delegate methods are not called. If any one is expert in this please suggest me how to get the paymentMethodNonce
Thanks in advance

iOS SDK: Custom open graph story with "Feelings"

I'm successfully publishing a custom Open Graph story, with a custom FBSDKShareOpenGraphAction and a custom FBSDKShareOpenGraphObject.
However, I can't find the documentation for assigning a "feeling" to the story. There are a few questions here on SO but the answers say it's not possible, although the Runtastic iOS app does it (see the "feeling awesome" part):
I'm not using the standard Share Dialog (FBSDKShareDialog) but am implementing my own custom interface as advised in their docs
Has anyone had any success with this? Any thoughts/ideas are greatly appreciated.

Fetch images from Instagram in iOS

I wish to fetch images from Instagram into iOS app. For this I am using Instagram API. I have set clientID and redirect-uri as shown in http://kmdarshan.wordpress.com/2013/02/23/integrating-instagram-sdk-in-your-ios-apps/ and http://instagram.com/developer/
Code used is given in link above. But in the line:
if ([[UrlParts objectAtIndex:(1)] isEqualToString:#"NeverGonnaFindMe"]) {...
the string always equals to oauth.
Where am I getting wrong? Anyone having any other option to integrate instagram images into iOS apps, please let me know.
I just found a project to fetch instagram images into ios app on:
https://github.com/hsandhu/HSInstagram
Awesome application, saved my time.
you can try this framework to show the instagram feed, both user and tags
https://www.cocoacontrols.com/controls/sbinstagram-viewer
is more complete and is easy to integrate
regards

Resources