Comments (8)
Comment by rfdickerson
Monday Jan 25, 2016 at 21:48 GMT
I have finished implementing the following. It attempts to find the types.json in "Sources/router/contentType/types.json", "Packages/Phoenix/Sources/router/contentType/types.json", then "./types.json". Notice the problem when Phoenix is pulled in, the tag will change based on the version. Perhaps we should have a way to find a directory that matches any string Phoenix-xxx where xxx is the tag version.
from kitura.
Comment by rfdickerson
Monday Jan 25, 2016 at 21:49 GMT
I used Foundation's JSONObjectWithData, however it returns an Any in Linux and AnyObject in Darwin. I would like to investigate if this breaks anything in Linux.
Create a Foundation object from JSON data. Set the NSJSONReadingAllowFragments option if the parser should allow top-level objects that are not an NSArray or NSDictionary. Setting the NSJSONReadingMutableContainers option will make the parser generate mutable NSArrays and NSDictionaries. Setting the NSJSONReadingMutableLeaves option will make the parser generate mutable NSString objects. If an error occurs during the parse, then the error parameter will be set and the result will be nil.
The data must be in one of the 5 supported encodings listed in the JSON specification: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE. The data may or may not have a BOM. The most efficient encoding to use for parsing is UTF-8, so if you have a choice in encoding the data passed to this method, use UTF-8.
Experiment: Note that the return type of this function is different than on Darwin Foundation (Any instead of AnyObject). This is likely to change once we have a more complete story for bridging in place.
from kitura.
Comment by rfdickerson
Monday Jan 25, 2016 at 22:44 GMT
@KALLNER This appears to work using Darwin's Foundation, however it Core dumps in Linux's Foundation- the error:
fatal error: unexpectedly found nil while unwrapping an Optional value
I believe this might be caused by the Any object inconsistency across platforms.
from kitura.
Comment by babt
Monday Jan 25, 2016 at 23:03 GMT
I've seen this with the "stock" compiler that ships with the latest Xcode. I was able to work around it so if you give me a bit more context I might be able figure out a workaround. It appears to be a bug in the compiler itself and to be cross platform since the fix I put in also worked when I tested the same module on Linux. I was testing on Linux as well as iOS so I narrow it down to reproducible scenario before open a bug with Apple.
Regards,
Bill Abt
[email protected]
Sent from my iPhone 6s
On Jan 25, 2016, at 5:47 PM, ROBERT F. DICKERSON [email protected] wrote:
@KALLNER This appears to work using Darwin's Foundation, however it Core dumps in Linux's Foundation- the error:
fatal error: unexpectedly found nil while unwrapping an Optional valueI believe this might be caused by the Any object inconsistency across platforms.
—
Reply to this email directly or view it on GitHub Enterprise.
from kitura.
Comment by rfdickerson
Monday Jan 25, 2016 at 23:07 GMT
Hi Bill, the problem is probably happening in
ContentType.swift in the initialize function. This isn't an issue with your ETSocket integration. That worked great, I think!
a run in lldb on Linux resulted in
Process 7845 launched: './.build/debug/sample' (x86_64)
fatal error: unexpectedly found nil while unwrapping an Optional value
Process 7845 stopped
* thread #1: tid = 7845, 0x00007ffff787ea88 libswiftCore.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () + 40, name = 'sample', stop reason = signal SIGILL: illegal instruction operand
frame #0: 0x00007ffff787ea88 libswiftCore.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () + 40
libswiftCore.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> ():
-> 0x7ffff787ea88 <+40>: ud2
0x7ffff787ea8a <+42>: movq $0x0, -0x10(%rbp)
0x7ffff787ea92 <+50>: movl %edi, %eax
0x7ffff787ea94 <+52>: cmpq %rax, %rdi
again, it is working in Darwin's Foundation. I made it toggleable so that I don't cause problems for those working in Linux.
from kitura.
Comment by babt
Monday Jan 25, 2016 at 23:37 GMT
Ok, cool. I'll take a closer look tomorrow and see if it's the thing I ran into and let you know.
Regards,
Bill Abt
[email protected]
Sent from my iPhone 6s
On Jan 25, 2016, at 6:07 PM, ROBERT F. DICKERSON [email protected] wrote:
Hi Bill, the problem is probably happening in
ContentType.swift in the initialize function.
however, a run in lldb on Linux resulted in
Process 7845 launched: './.build/debug/sample' (x86_64)
fatal error: unexpectedly found nil while unwrapping an Optional value
Process 7845 stopped
- thread #1: tid = 7845, 0x00007ffff787ea88 libswiftCore.so
function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () + 40, name = 'sample', stop reason = signal SIGILL: illegal instruction operand frame #0: 0x00007ffff787ea88 libswiftCore.so
function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> () + 40
libswiftCore.so`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage (Swift.StaticString, Swift.StaticString, Swift.StaticString, Swift.UInt) -> ():
-> 0x7ffff787ea88 <+40>: ud2
0x7ffff787ea8a <+42>: movq $0x0, -0x10(%rbp)
0x7ffff787ea92 <+50>: movl %edi, %eax
0x7ffff787ea94 <+52>: cmpq %rax, %rdi—
Reply to this email directly or view it on GitHub Enterprise.
from kitura.
Comment by rfdickerson
Wednesday Jan 27, 2016 at 14:54 GMT
Still blocked until the issues with using JSONSerializer in Linux are resolved. Should we look to create a custom JSON parser until that gets resolved in corelibs-foundation?
from kitura.
All types added in content.json. We need to make a new issue to convert into swift source code.
from kitura.
Related Issues (20)
- Update CLA HOT 1
- NET::ERR_CERT_COMMON_NAME_INVALID
- Exported OpenApi uses unexpected type for date. HOT 1
- XCode 12 Build broken due to static package dependency HOT 10
- [Question]Is it possible set Kitura-NIO as default in Xcode 11.6 HOT 2
- [Question]It is possible set custom working dir(without using Xcode)?
- [Issue]Swift-Kuery-SQLite (Release 2.0.200) in Xcode HOT 4
- Kitura cannot build and run project HOT 1
- Is it possible use response to render html string? HOT 3
- Document SwaggerDocument
- Kitura.dev should point to valid Slack group HOT 3
- Some tests need investigation
- BUG DETECTED: wait() error when using SwiftyRequest, CouchDB and NIO
- upgrade from 0.1.0 to 0.2.1, kitura command totally mess up HOT 3
- No support for Get with ID and Query params
- align dependencies URLs HOT 1
- Investigate alternative CI systems
- Thank you dannys42! HOT 1
- Odd behavior when 2 simultaneous POST requests happen HOT 1
- Slack link on web page is broken HOT 4
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 kitura.