Comments (5)
Use:
AFMotion::Image.get("https://www.google.com/images/srpr/logo11w.png") do |result|
puts result.object # UIImage
end
from afmotion.
My understanding is that this does not retrieve the actual bits, it retrieves an NSImage object. Am I wrong?
from afmotion.
You can use the UIImage object to extract that information, no?
imageData = UIImagePNGRepresentation(image) # NSData instance
from afmotion.
While I was not aware of that, it still has a problem that I'm recompressing the image that came from the remote side, and doesn't address the core issue. (I'm sorry I used an image as the example here, it confused the problem.)
My core issue is that the AFMotion::HTTP.get
method apparently expects HTML, when it shouldn't force any particular content-type. If I want to use it to retrieve an application/dmg it should work.
Here's the headers that it sends (with the 2.1.4 version):
GET / HTTP/1.1
Host: localhost:9090
Accept: */*
Accept-Language: en;q=1, ja;q=0.9, fr;q=0.8, de;q=0.7, es;q=0.6, it;q=0.5
Connection: keep-alive
Accept-Encoding: gzip, deflate
User-Agent: MyApplication/1.0 (Mac OS X Version 10.9.2 (Build 13C64))
Given that it says it accepts */*
, I think that the content type shouldn't fail on return. Is there an easy workaround to force AFMotion::HTTP.get
to actually retrieve an arbitrary content-type, potentially returning it as NSData or something similar?
from afmotion.
Ah! I understand now; your other fix 12caa46 apparently fixed this! I can now access request.object as follows:
AFMotion::HTTP.get("https://www.google.com/images/srpr/logo11w.png") {|result| p result.object }
Thanks muchly!
from afmotion.
Related Issues (20)
- Example app crashes HOT 1
- How to set headers per request? HOT 1
- documentation update: mention OS X HOT 2
- Error for OSX in 2.6: uninitialized constant AFMotion::SessionClientDSL::UIDevice HOT 3
- Upgrade to support AFNetworking 3.0? HOT 4
- Synchronous operation HOT 2
- Can we update to AFNetworking 4.0? HOT 2
- Would really like to see update to AFNetworking 4.0? HOT 2
- http requests from macOS get a malloc error. HOT 1
- AFHTTPSession#delete attempts to call private method HOT 1
- using AFMotion::Client object to fetch image results in error com.alamofire.error.serialization.response HOT 2
- statusCode calling on nil. HOT 2
- Get Headers for JSON response HOT 6
- afmotion just crash HOT 1
- Having problem to upload file when using background session configuration HOT 1
- Unable to satisfy the following requirements: AFNetworking (~> 2.5) HOT 2
- No response on HTTP.get HOT 4
- Any way of getting progress of GET operations? HOT 4
- How would you use AFMotion to download a file (e.g. to Documents directory)? HOT 2
- Crash with AFNetworking 2.6.0 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 afmotion.