I am developing a product like DropBox and Box application, and I need to verify Rename/Add/Delete I/O operation using automation.
I am writing UI Automation Test Cases using XCUITest in Xcode.
In that I need to use I/O operation for rename file/folder but It gives the below error while using moveItemAtPath function to rename folder:
Error Domain=NSCocoaErrorDomain Code=513 "“Folder” couldn’t be moved because you don’t have permission to access “Folder1”." UserInfo={NSSourceFilePathErrorKey=*path, NSUserStringVariant=(
Move), NSDestinationFilePath=*destiPath, NSFilePath=*path, NSUnderlyingError=0x6000002507d0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
Its working fine when running the app in main target and also its working in UnitTest target but its not working while running UITest automation target.
NOTE: App Groups are also enabled.
Any help is appreciated!
Try changing the folder you writing to or in your case i dont know why you're renaming the folder. If you've to do something to your folder then perhaps having that folder in one of these locations Documents, Temp and Cache. Most likely, you will want to write to the Documents folder.
It seems to me like a codesign error. Refer this post NSFileManager creating folder (Cocoa error 513.)
Try this below approach. I'm quoting apple documentation - https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW22
Scenario 1:
Your app needs to be able to save a file with a different extension than that of the original file. For example, when you paste an image into an RTF file in TextEdit and save it, TextEdit changes the file’s extension from .rtf to .rtfd (and it becomes a directory).
To handle this situation, you must use an NSFileCoordinator object to coordinate access to the file. Before you rename the file, call the itemAtURL:willMoveToURL: method. After you rename the file, call the itemAtURL:didMoveToURL: method.
Scenario 2:
Your app needs to be able to open or save multiple related files with the same name and different extensions (for example, to automatically open a subtitle file with the same name as a movie file, or to allow for a SQLite journal file).
To gain access to that secondary file, create a class that conforms to the NSFilePresenter protocol. This object should provide the main file’s URL as its primaryPresentedItemURL property, and should provide the secondary file’s URL as its presentedItemURL property.
After the user opens the main file, your file presenter object should call the addFilePresenter: class method on the NSFileCoordinator class to register itself.
In both scenarios, you must make a small change to the application’s Info.plist file. Your app should already declare a Document Types (CFBundleDocumentTypes) array that declares the file types your app can open.
For each file type dictionary in that array, if that file type should be treated as a potentially related type for open and save purposes, add the key NSIsRelatedItemType with a boolean value of YES.
To learn more about file presenters and file coordinators, read File System Programming Guide.
I'm new to FMDB and I'm following this tutorial. I create the database in terminal. I'm having a problem after I add my database to xcode and compile. It is not automatically in UTF-8. There are weird characters so there are lots of errors and it won't compile. Here's a screenshot:
SQLite is a binary format, and as such, you won't be able to view it or compile it in Xcode. Instead, you want to make sure it is treated as a resource like images. Make sure it's copied to your resources folder as well.
FMDB + SQLite does UTF-8 just fine- but the Xcode editor isn't the way to view it (you'll have to get at its contents pragmatically).
I created a Word 2013 document and did the following:
Added a Plain Text Content Control to it at design time.
Added a Custom Xml Part at design time.
Did a mapping from one node of Custom Xml Part to the Plain Text Content Control.
The value of node appeared in the Content control.
I saved and closed the document.
Renamed it to .zip and extracted it to a folder.
Edited the file in folder customXml/item1.xml which is my custom xml part and changed the value of node from <Name>John</Name> to <Name>Harry</Name>.
Re archived it as a zip file and renamed it to .docx.
When I opened the document, it was corrupted and Microsoft Word says:-
We're sorry. We can't open XYZ.docx because we found a problem with the contents. Microsoft Office cannot open this file because some parts are missing or invalid.
Reason - You cannot unzip and re-zip your .docx file as you did in Step 8
Guide - Try this. Create a dummy .docx file form word. Extract it and re-zip it and try to open the file. You will get the same error and you will not be able to use it as you expect.
Solution - If you want to edit your .docx file , use Open XML SDK and do it. Here is a link to a good guide - http://msdn.microsoft.com/EN-US/library/office/cc850833(v=office.15).aspx . And also Open XML productivity tool will come in handy - http://dotnet.dzone.com/articles/using-openxml-sdk-productivity
I was zipping and unzipping incorrectly. We don't need any Open XML SDK.
What I was doing was: Right click on XYZ.docx.zip and select Extract to XYZ.docx. When it got extracted into the folder XYZ.docx, I edited the contents inside and then zipped the entire folder to XYZ.docx which is wrong.
When I got inside of folder and zipped only the contents to XYZ.docx.zip, it started working.
I want to update or replace Localizable.strings Runtime. i have .strings files on server. so if any one can update .strings files on server. then also i need to update value or replace into bundle.
or
can i read .strings file form server directly? and make all static string localized.
Sure you can. You have to roll your own.
If you look at the NSLocalizableString macro, you can make your own like :
RMLocalizableString that instead of pointing to the resources, points to a file you have downloaded in your documentation folder. But of course you have to make sure the file is actually there.
I'm trying to upload my binary to iTunes Connect using Applicaton Loader. When I select the file and hit send, it sends for about a second and then this error pops up,
Icon specified in the info.plist not found under the top level app wrapper: Default -Landscape#2x~ipad.png
What does this mean? How do I fix it?
Another setting that can cause the issue:
You have to make sure the icon files are also found under build phases/bundle resources
Edit your projects .plist file "as source code" i.e. open it in any old text editor. Then manually edit the icon file names until they make sense.
The .plist is case-sensitive when validated and archived for upload to the App Store.
If you have this in the .plist:
icon-72#2X.png
the file name can not be
icon-72#2x.png
owing to the the case change of the x character .
I rename the file and corresponding change the name of icon file in the info.plist and this solution works for me.
Clean your build
Make sure the file is actually on the file system
Make sure you can see the file in the project navigator.
Most likely step 3 will fail. If so, drag the icon from the finder onto the Project Navigator. When asked, uncheck the "copy ..blabla" option because since the file is already there where you are dragging it to, it would fail. Once the file shows up in the Project Navigator you should be golden.
Also check that you dont have 2 icons with the same name anywhere in your project folders.
I am thinking that the answer to this question will vary in time because Apple constantly changes the application validation rules. These validation rules will surface only when you are submitting your app to the AppStore.
In this particular situation, the validation error happened to me while uploading the app on 08/03/2012.
The solution was fairly straight forward. I had to move to icon files which I had located in a folder nested within the project directory all to way up to the TOP LEVEL project directory - one that has the project file in it. Once I did that and readded the files back to the Resources in my project the validation error went away.
Of course you should check that this issue is not caused by misspelled filenames i.e. differences between your plist file and true names of icon files on your file system.
Another little issue that caught me out was an empty string. I got the cryptic failure message ...
Icon specified in the info.plist not found under the top level app wrapper:
And found this lurking in my plist
<string></string>
I was similar problem's. I have resolve to do this
1/ delete your application Icone in your Target
2/ rename your icone ex: applicationNameSmall.png
3/ add your icone in your application.
This, works for me.
Error is coming up because the App Store is checking names of icon files based upon yourProject-info.plist. If they don't match, error message.
To resolve this issue: Go to yourProject-info.plist in xcode and check BOTH "icon-files" and "icon-files(IOS5)" arrays. You'll want to make sure that each string corresponds with the icon files you have in the file directory.
Change or delete mismatched string names (I had to delete a blank string). Rebuild. As other posters have noted, names are case-sensitive, so be mindful of that too.
Sometimes Icon.png files needs to be open in some image editing tool (e.g Adob Photoshop) and save as a new image. This works fine. Check attached images some times image properties don't change by renaming image file manually.
I had the same issue. I just added the image files it complained about to the project in the viewer. Not sure if that was the right thing to do, but it resolved the issue for me.
I had a silly mistake, in my info.plist the i had Icon.png, and the real file name was icon.png (no uppercase)
Fix the images issues it suggests.
Clean your project.
Build and run to make sure nothing has broken.
Delete the previous archive
Make a new archive (Product -> Archive)
This worked for me. I had to rearchive my application cause the previous one was not updated.
I had the same problem. I gone to Targets->Build Phases and deleted from there old (test) icons which I had pushed early. Good luck:)