Comments (8)
Could you also share more details about this behavior? What do you mean by "file is not read"? Is an error thrown in the code that you're catching? Does it trigger any of the fatalError
or print
conditions? Have you stepped through the code with the debugger to pinpoint the exact line at fault?
from corexlsx.
Could you also share more details about this behavior? What do you mean by "file is not read"? Is an error thrown in the code that you're catching? Does it trigger any of the
fatalError
or
it triggers fatalError before I added startAccessingSecurityScopedResource
fatalError("excel file is corrupted")
when I added it as the solution from #160 it triggers the print statement
print("failed accessing security scope")
from corexlsx.
In your code from the description, you're assigning a path URL passed by the document picker as let filepath = url.path
and never using it again, then you're trying to read from a new directory looked up by NSSearchPathForDirectoriesInDomains
. I'm not sure I understand how a document picker is relevant here if you're not reading anything from a path provided by it.
from corexlsx.
Originally this is what I did
let url = urls[0]
let filePath = url.path
guard url.startAccessingSecurityScopedResource() else {
print("failed accessing security scope")
return
}
defer { url.stopAccessingSecurityScopedResource() }
guard let file = XLSXFile(filepath: filePath) else {
fatalError("XLSX file at \(filePath) is corrupted or does not exist")
}
However it did not work so the next thing I tried was copy it to NSSearchPathForDirectoriesInDomains
The aim of the code is to pick an excel file from the document picker and read it but I had no luck in getting it to work
from corexlsx.
And in this original code, which exact line was bailing out, url.startAccessingSecurityScopedResource()
or XLSXFile(filepath: filePath)
?
from corexlsx.
url.startAccessingSecurityScopedResource()
from corexlsx.
Have you tried following this SO page? https://stackoverflow.com/questions/41144992/startaccessingsecurityscopedresource-return-always-false
According to it, startAccessingSecurityScopedResource
may return false
when the file is not secured, but it may still be readable.
from corexlsx.
Hi @tburnt, is this issue still reproducible for you?
from corexlsx.
Related Issues (20)
- Cannot initialize SchemaType from invalid String value HOT 2
- Unable to sort columns by intValue HOT 2
- Cannot read xlsx with inline string.
- Cannot initialize SchemaType from invalid String value http://customschemas.google.com/relationships/workbookmetadata HOT 2
- Cannot initialize SchemaType from invalid String value HOT 7
- Next Release? HOT 2
- Xcode 12.5 Compile Error HOT 1
- cell type is null HOT 1
- Get a dropdown list HOT 1
- Invalid default buffer size HOT 1
- Unable to parse excel with following code HOT 5
- XLSXFile fails to open .xlsx file located on iPad ("XLSX file at \(file_path) is corrupted or does not exist") HOT 5
- Support macOS APP development? HOT 2
- Distinguish date and number HOT 4
- File can not parsed HOT 2
- Excel Parser Truncates Leading 0's and Maybe Trailing 0's HOT 2
- Cell Formulas
- Not working when using FILTER function HOT 3
- Get named Area of a sheet
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 corexlsx.