Comments (5)
Can you provide back trace? Pseudo code is not helpful since it's not crashing for anybody else.
Daniel Duan
Sent from my iPhone
On Sep 22, 2016, at 4:49 AM, aguel [email protected] wrote:
My app crashing using asynchronous callback but works fine when switching to synchronous mode. I dont know why.
Pseudo Sample:
APP CRASHING:
Just.post(
"http://justiceleauge.org/member/register",
data: ["username": "barryallen", "password":"ReverseF1ashSucks"],
files: ["profile_photo": .URL(fileURLWithPath:"flash.jpeg", nil)]
) { r in
if r.ok { /* SOME CODE HERE! */ }
}THIS WORKS:
let r = Just.post(
"http://justiceleauge.org/member/register",
data: ["username": "barryallen", "password":"ReverseF1ashSucks"],
files: ["profile_photo": .URL(fileURLWithPath:"flash.jpeg", nil)]
)if r.ok { /* SOME CODE HERE! */ }
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
from just.
NSURLSession has some asserts that if not respected by your code will yield crash. For example, use of asynchronous upload methods (with completion handler) in a background NSURLSession configuration.
from just.
Do you have any sample code? The documentation provides only simple example. Thanks.
from just.
I had a crash with asynchronous callback saying that Im updating UI in background thread. As in the Note given here, I have to dispatch UI update to main thread. Great if callback is already wrapped into main queue by JustHTTP.
DispatchQueue.main.async {
//Update UI here.
}
from just.
Just can't wrap callback for you because lots of times that's not what user needs. You'll find after a networking call, there's more work to do (processing things you just downloaded, for example) before you need to update UI.
This is also the design decision made by Apple with NSURLSession.
Daniel Duan
Sent from my iPhone
On Sep 25, 2016, at 8:24 AM, sravanco [email protected] wrote:
I had a crash with asynchronous callback saying that Im updating UI in background thread. As in the Note given here, I have to dispatch UI update to main thread. Great if callback is already wrapped into main queue by JustHTTP.
DispatchQueue.main.async {
Update UI here.
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
from just.
Related Issues (20)
- Authentication is not happening in swift 4 HOT 1
- Playground Execution Failed
- POST is returning nil response in Swift 4
- How to use Just in multipart?
- Just is giving code -1001 HOT 1
- Multiple Image
- Can Just Support proxying HTTP requests? HOT 1
- Just.get params always return string Optional HOT 1
- Just.framework missing CFBundleVersion when uploading HOT 7
- Not available like pod
- Multiple endpoints
- How can I send a single string parameter?
- Not building in Xcode to run on device
- Does Just follow redirect links?
- Just.get() crash when `makeTask` HOT 2
- It seems like `asyncCompletionHandler` is executed before download task is done HOT 1
- [Suggestion] Completion handler should be call on Main Thread
- Utilizing r.json response? HOT 2
- Just Library is not supported for Xcode 12 and above HOT 1
- How to Download file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from just.