When I test my application on iPad it run perfectly i.e. call the database , create folder and perform other task but in console it show me
2015-05-12 1
The format you using for getting date string is "yyyy-MM-dd HH:mm:ss" which introduces a space in the result string. Remove the space in the formatter so that it looks like this "yyyy-MM-ddHH:mm:ss" and try the above code or you could replace the space in the resulting path and write data to the file
The problem is that you are trying to create a file in your app's bundle. The bundle is read-only in iOS (and you should treat it as read-only on Mac OS as well, even though it is possible to write to your app bundle in Mac OS.)
Your code will work on the simulator because changing the app bundle is allowed on Mac OS, and the simulator runs under Mac OS.
Change your code to use your documents directory, temp directory, or some other directory in your bundle and you should be fine.
The 513 is a permission issue (NSFileWriteNoPermissionError).
Try to println the LogFolderPath and double check if it is correct (or post it here the result).
D.
I've been thinking about this scenario, and I can't come up with any better suggestion than: Race Condition
?
Could it be that two treads are trying to log at the same time? The first one creates the folder directly after the second tread is passing the .fileExistsAtPath check?
If this is the case, it could solve the problem by moving the create directory check and logic to a earlier stage, like on App start or similar.
Not sure this is the issue or that this is the definite answer, so just let's call it a qualified guess... :)