could not determine generated file path for core data (Xcode 8, swift 3) - swift3

How do you resolve this issue?
image of message
(Black lines are to hide my username and project name)

Please check the path of your .momd file once. According to image you've provided, /Users/.../Library/Mobile Documents/com~Apple~CloudDocs/.../MyModel.momd is the path expected. But, it couldn't read the core-data file from that path. Please move your .momd file to that expected path and try building it again.

I got "could not determine generated file path for core data" when I moved my Core Data Model to a different folder. Go to your project file. In your Build Phases tab locate the model under Compile Sources and remove it. Then press + to add it back but DO NOT select it from the list you see right away (does not update the file path). Instead select "Add Other" and go select it from it's new location. Then leave the defaults of "copy if needed". Clean your build folder and you're good to go.
In my case this left me with 2 models in my property pane. I deleted the old and dragged and dropped the new one into the correct Xcode group. And all was right with the world again. Hope this helps someone else out.

Related

Set screenshot path from default project location to different folder location

I have a suite which has 50 test cases. When I execute my suite, I get all the failed screenshots listed in the project's folder. I want to point and store those screenshots to a different directory with the name of the test case. I wanted it to be a one time setup than doing it explicitly for every test cases.
There's quite a few ways to change the screenshots default directory.
One way is to set the screenshot_root_directory argument when importing Selenium2Library. See the importing section of Selenium2Library's documentation, and importing libraries in the user guide.
Another way is to use the Set Screenshot Directory keyword, which will do pretty much the same thing as specifying a path when importing the library. Though, using this keyword you can set the path to a new one whenever you like. For example, you could make it so that each test case could have it's own screenshot directory using this keyword. According to your question, this may be the best solution.
And finally, you may also post-process screenshots using an external tool, or even a listener, that would move all screenshots to another directory. Previously mentioned solutions are in most cases much better, but you still may want to do this in some cases, where say, the directory where you want screenshots to be saved would be created only after the tests have finished executing.
I suggest you to do the follow:
For new directory, you should put the following immediately after where you open a browser such:
Open Browser ${URL} chrome
Set screenshot directory ${OUTPUT FILE}${/}..${/}${TEST_NAME}${/}
For replace the screenshot name from the default to your own name, create the following keyword:
sc
Capture page screenshot filename=${SUITE_NAME}-{index}.png
Then, create another keyword and run it on Setup's test case:
Register Keyword To Run On Failure sc
In the above example, I created a new folder with the test case name, which create a screenshot (in case of failure) with the name of suite project name (instead of 'selenium-screenshot-1.png').

Navigate to the file from output in the terminal - WebStorm

Is it possible to tune WebStorm so that when I have something like this in my terminal window, then I just click on the filename and jump to it.
Not possible using built-in terminal (please vote for IDEA-118566 and IDEA-154439).
Awesome Console plugin might be a solution; but it doesn't support built-in terminal (https://github.com/anthraxx/intellij-awesome-console/issues/23)
there is also Output Link Filter plugin that provides similar functionality, but it looks outdated and (also) doesn't work in built-in terminal
Update (2022): IDEA-118566 is already fixed, links should work. Please note that providing links for particular output needs adding specific logic handing such output. Thus, if you encounter missing links in a particular output, please file a separate issue request describing link output format and steps to reproduce such output.
Webstorm does in fact now have this functionality.
Note that the bug about this functionality being missing (linked in another answer) has been marked as fixed: https://youtrack.jetbrains.com/issue/IDEA-118566.
It's not quite a single click solution, but what I do, is double click the text so that it auto selects and copies the path, including line and char numbers to clipboard. Then use the shortcut for Goto File.... Hit paste (cmd+v) then Enter and it will take you to the exact location.
For me, the shortcut for Goto File... is cmd+shift+O - you can check your shortcut in the menu Navigate -> File...
You can use the following format to output text in the terminal via console.log and the path will be clickable:
at ($FILE_FULL_PATH:$LINE_NUMBER:$SYMBOL_NUMBER)
Example with the full path to the file:
at (/home/ubuntu/project/index.js:12:55)
However, if you're running WebStorm with exact file path's project's folder, you can use the following format:
at (./project/index.js:12:55)
I installed Awesome Console plugin and with this plugin, all files and links in the console and terminal will be highlighted and can be clicked. Source code files will be opened in the IDE, other links with the default viewer/browser for this type.
You can jump to files from the terminal with left click
Just select file path (dblclick) & press "shift" twice (search everywhere) & press "enter"...

NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription ignored

Xcode 8.2 beta 8C30a, Swift 3, iPhone 5s.
I'm writing a weather app that wants to use the iPhone's location. To get authorisation I have set (all of) the following my Info.plist:
<key>NSLocationAlwaysUsageDescription</key>
<string>Your current location is used to provide you with a local weather forecast.</string>
<key>NSLocationUsageDescription</key>
<string>Your current location is used to provide you with a local weather forecast.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your current location is used to provide you with a local weather forecast.</string>
Nevertheless, when I call LocationManager.requestWhenInUseAuthorization() then I get the following error:
This app has attempted to access privacy-sensitive data without a usage description.
The app's Info.plist must contain an NSLocationWhenInUseUsageDescription key
with a string value explaining to the user how the app uses this data
The key is there but not being seen. There is no entry for the app in the phone's settings menu (nor under privacy). Doubtless, I'm missing something simple. Any ideas?
I just encountered the same problem with one particular App, and I have several Apps with the same structure which are working just fine when I request authorization for Location Services.
In all cases, I have localized the Application, so I have several Info.plist files in my XCode project (e.g. one for the Base language which is English, another for French, etc).
I always manually edit my Info.plist files (viewing them "as Source Code") and add the NSLocationWhenInUseUsageDescription fields).
But in this specific App's case, I noticed that XCode was NOT showing the NSLocationWhenInUsageDescription field when I selected the App Target in the Project's list of Targets and then clicked on the "Info" tab. This is odd, because when I check the "Info" tab in my other XCode projects, edits made to the Info.plist file for the Base language appear here. So I manually added a NSLocationWhenInUseUsageDescription field to this "Info" UI and suddenly my new App was working correctly, requesting the user's permission to access Location Services when in use.
I'd recommend checking that all the fields you have added to your Info.plist file are reflected in the Target/Info screen. If they are not, you may have a similar problem, in which case the same fix may work for you.
I am guessing the root cause of the problem is a bug in the localization process. I recall that after selecting the Info.plist file as one of my localized files, I got an error from XCode at build time, complaining that it was missing an Info.plist file (it had moved Info.plist from the base.lproj folder to en.lproj when it "localized" the file). I reinstated the file that XCode had moved from the base.lproj folder to the en.lproj folder, and that seemed to make XCode happy again. But I think somehow it lost the ability to refresh itself, so subsequent additions to the Info.plist file(s) aren't being applied everywhere they need to be).

How to undo move files from filezilla

I have one problem about filezilla. I accidentally move one folder to wrong directory, so it shows the errors when I view my website.
How can I solve it? Please help me.
Many thanks in advance for your answer.
You cannot undo, but you should understand why that happened and how to prevent that from happening again in the future.
This happened because Filezilla allows Drag-and-drop move functionality on both folders (directories) and files, very dangerous on production servers.
There is actually a feature-request for 11 years now, please add your vote to the list to get this done: https://trac.filezilla-project.org/ticket/2191
In the mean time, please consider using another software that allows the user to set this behavior as an option:
WinSCP: http://winscp.net/eng/docs/screenshots
WS-FTP Pro: https://trac.filezilla-project.org/attachment/ticket/2191/ws_ftp-professional-options.gif
EDIT: Filezilla team responded (sort of) to the feature request and you can block drag and drop in the xml config file. It's better than nothing.
You cannot undo ftp moves. The only way to rectify the problem is to manually move the folder to it's original location.
I suggest you be more careful from next time.
If you don't know where the folder belongs, download the x-cart script package and check where the directory belongs.
Sorry for late, but I am up to date. I get logs from filezilla of moved files.
Status: Renaming '/var/www/html/brb/abc.js' to '/var/www/html/brb/node_modules/abc.js'
Status: /var/www/html/brb/abc.js -> /var/www/html/brb/node_modules/abc.js
Status: Renaming '/var/www/html/brb/xyz.html' to '/var/www/html/brb/node_modules/xyz.html'
Status: /var/www/html/brb/xyz.html -> /var/www/html/brb/node_modules/xyz.html
I write script in js to build command
let x = ['/var/www/html/brb/abc.js -> /var/www/html/brb/node_modules/abc.js',
'/var/www/html/brb/xyz.html -> /var/www/html/brb/node_modules/xyz.html'];
let cmd = [];
x.forEach(p => {
let path = p.split('->');
cmd.push(`mv ${path[1]} ${path[0]}`);
})
console.log(cmd);
Output:
['mv /var/www/html/brb/node_modules/abc.js /var/www/html/brb/abc.js'
'mv /var/www/html/brb/node_modules/xyz.html /var/www/html/brb/xyz.html']
Use any editor like vscode etc and remove string quotes and execute command in server terminal etc
mv /var/www/html/brb/node_modules/abc.js /var/www/html/brb/abc.js
mv /var/www/html/brb/node_modules/xyz.html /var/www/html/brb/xyz.html
A simple answer is,
Copy the folder into the desired location and then delete from the current location where you moved it mistakenly.
Now, what if you overwrite a file.
I just edited a file in local, then downloaded the file from my server into the local, and my all the local updated data is gone. There seems no solution of this, but there may be one possibility, I may be the lucky enough that this is my case.
If you were working on that local file, so most probably it is opened in your browser. Do not refresh it. Copy the content one by one, and update the file again. You can also open developers tools of both old and new page. Compare them line by line and do the job.
I had the same issue and resolved it manually.
The log panel was helpful in this. It is the large panel below the connection form in the top menu.
From that log panel, I was able to figure out all the files which were moved with their current and previous location.
I copied those all log lines and paste them somewhere in notepad and then manually selected all files and move those all at once to their original directory.
Screenshot: The log panel showing last actions

How can I change the file type association of an existing file in WebStorm?

I accidentally created a file with no extension and I chose the wrong file type association. Text Document I think. I renamed it to have the .js extension which is what I wanted, but now it's stuck without any syntax highlighting. WebStorm doesn't treat it as a javascript file. I can't find anywhere to change how WebStorm treats this file. I've tried renaming it and renaming it back and that doesn't work. With any other name, (with a .js extension) it treats it as a javascript file, but not as the original name.
How can I fix this? The WebStorm documentation is no help.
In Settings (or Preferences for mac) > Editor > File Types you can edit patterns by which a file gets associated as some type or other.
If you select the patterns for a file type you have wrongly selected (in your case Text type) you can remove the filename pattern with which was created to associate you file's filename as a wrong type.
Then click Apply > OK
I've had this problem in php storm 8.0.3 on OSX.
I was struggling with a single file that had been added as a text file, but I'd typed in the .js extension.
I tried deleting and recreating, renaming and renaming back, deleting .idea altogether. Nothing worked.
I found that PHPStorm had added the entire file name to the list of patterns for a text file.
....
*.txt
myfile.js
... etc
This was obviously overriding all other settings. And futhermore it was in the IDE Config not the project config. So I'm guessing every other project would have suffered the same issue.
Once I knew where to look it was easily fixed.
Navigate to:
PhpStorm > Preferences > Editor > File Types > <highlight> Text files
Then find myfile.js in the Registered Patterns panel and delete it.
The file should immediately assume it's correct association.
Go to Settings->File Types and then click on "Text Files". You should see the file if you scroll down. You can then remove it with the association by selecting it and clicking the - (minus) button
Refer to File -> Settings -> IDE Settings -> File Types
In right select "Text files" in Reconigzed File Types then find in Registered Patterns your file and click remove your file
On Windows 8, I was able to remove the invalid association by going under File > Settings > Editor > File Types, then I selected "Text files" as the Recognised File Type and removed the invalid entry from the Registered Patterns block at the bottom.
So much answers and everything is close but no one as in my case.
A had an issue with .vue files. My old PHpStorm version did not track the .vue files, so I somehow associated them as .js files. However, this was a mistake because the syntax is different and I saw a lot of "mistakes" in the code.
Yeah, the solution is really in Settings (or Preferences for mac) > Editor > File Types dialogue. In the window you can see the list of possible associations. At the very bottom of the list you'll see the Vue.js Templates and I had no associations in the bottom window (see the pic), so I manually added *.vue association after clicking green "+".
I think this would be right for any proper file type added to PHPStorm. However, you can add your own file type.
In the new WebStorm versions we can click on the file, select the option Override File Type and change for the type that we want.
Selecting the Override File Type option:
Selecting the file extension:
I have found in phpstorm that I can use the Refactor > Rename... function to associate a file of unspecified file type (e.g. a name with no extension) with a file type.
For example if I have a bash script named do_the_things I can Refactor > Rename it to do_the_things.sh which causes it to pick up the bash highlighting, then when I Refactor > Rename it back to do_the_things it keeps the bash highlighting.
This works in PHPStorm, i can assume in WebStorm should be something similar
Go to Preferences directory
Here is how to find for your OS
https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs
Find a file YOUR_PREFERENCES_DIRECTORY/options/filetypes.xml
Edit it with any text editor and delete needed row, for example
<mapping pattern="delete.yaml" type="PLAIN_TEXT" />
Top Menu File->Invalidate Caches / Restart
Enjoy
In my case, the file in question, DepositBreakdownList.js, was associated with a "type" called "File type auto-detected by file content". Selecting it and then removing it (with the minus sign button) allowed the file to be treated as a proper JavaScript file again.
Until I did that, I was unable to use Live Templates associated with JavaScript, even though the file extension was .js, which was just maddening.
I've found a solution,
delete (o rename as .old) the file:
C:\Users\.PyCharmCE\config\options\filetypes.xml
Es:
C:\Users\goofy.PyCharmCE2018.3\config\options\filetypes.xml
After like an hour of searching and screwing around I found a fix:
I renamed the file (through the refactor command) to a temporary file name. Then I created a new file with the correct name with the .js extension and it worked, then I copied the code from the original to the newly created file with the correct extension.
I imagine selecting "new javascript file" and doing the same thing would also work.