Can't open Swift Guided Tour Playground - xcode

When I try to open the Swift Guided Tour playground from Apple's e-Book, it says "the document can't be opened because it is from a newer version of Xcode. As far as I can tell, I'm using the newest non-Beta version, and I'm not working with Swift 2.0 yet, still learning the first version. Have all the playgrounds been updated to work with Xcode 7 Beta or something? I'm using Xcode 6.3.2, just in case that isn't actually the newest version.

I got the same issue with xcode 6.3.2.
I got the issue when I downloaded it via ibook link. Once I downloaded it via we, it worked.
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html#//apple_ref/doc/uid/TP40014097-CH2-ID1
My previous version was playground version='1.0' and the new one also same. But it includes lots of new libraries.

I got that problem too, and finally i open it OK, that just problem with where you download your .playground file:
#Xcelleratr Download your file here:
https://developer.apple.com/library/mac/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html
It will be OK my friend :)

works for Xcode version:
Version 6.3.2 (6D2105)
Version 7.0 beta (7A120f)
Im guessing it was corrupted could check it by:
Right clicking on the playground file > show package contents > open contents.xcplayground in a text editor like sublime and look for playground version='3.0' near the top
If this is any higher it will pop up with the error you seen.

Just in case someone stumbled upon this problem, here is what happened to me:
Download from guided tour page.
Save it with .zip extension instead of .playground, as seen in this picture:
Double click the downloaded file, it will unzip it and you'll get your actual GuidedTour.playground file.

So if you have a playground file and it only opens xcode and not a guided playground, right click the playground fle and show package contents, then go to contents.xcplayground and rightclick and open with text editor.
I had to change this line...
display-mode='raw'>
to ....
display-mode='rendered'>
then save and when you go back and open the playground it should be ok now.

Related

How to open higher xcode version project(13+) into lower xcode version(12 or lower)?

I recently updated my XCode to latest(period) 13.3 and working on a project on that, Now when i moved that project to other mac which has MacOS Catalina and has XCode version 12.3.
When i try to open the project it keeps showing me this dialogue
But i found a solution to make it work on lower version XCode which can be useful to other people too, So i am including answer too.
Hope It Helps :)
Just have to follow steps given below
Right Click On Your_Project_Name.xcodeproj and select Show Package Contents from the option menu. { Even if you have .xcworkspace, ignore it for now }
Open project.pbxproj from opened folder.
Change object version to 46 like given below
Hit Command(⌘) + S to save it and close the window.
If you have pods installed on that project then you have to reinstall them again { I guess you already know how to do that or follow setps given below }
Open Terminal
Run Command cd PATH_TO_YOUR_PROJECT_FOLDER, Hit Enter
Run pod install {No need to open podfile as we never made a change to it} and we're done
Go back to project folder and open Your_Project_Name.xcodeproj or Your_Project_Name.xcworkspace
NOTE:
Since It is work around way, we can not run this on newer iOS version simulator on which we want to test code However, we can run the code on physical device which has newer iOS version { which is also tricky part! }
TO RUN THE CODE ON LATEST IOS PHYSICAL DEVICE, FOLLOW BELOW STEPS
Download zip of your desired iOS version to run from the link
Close the XCode App.
Right click on XCode App from Application and select Show Package Contents
Move the downloaded folder to Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport.
Open the project and run it on physical device
If you get error of Unable to install the Application, click on Details and try to resolve it.
If your error says The code signature version is no longer supported then check out this answer, it solved the error.
Hope It Helps !!!

No such module "CreateMLUI"

I am using macOS Mojave Beta (10.14 18A293u) and Xcode 10.0 Beta (10L176w). I created a Swift Playground and I am unable to import CreateMLUI framework in order to use it. I keep getting an import error.
I have tried creating both an iOS Playground and a macOS Playground
Anyone knows what I am doing wrong?
Thanks in advance.
While macOS Mojave and Xcode 10 are in beta you may experience bugs while trying to use CreateML.
#Koen from one of the comments in my question found a topic in Apple Developer Forums with some workarounds. What I did was:
Create a new single view Mac OS (NOT iOS) playground
Use a completely different name if already created a buggy playground (this is important)
Add the import CreateMLUI line
Remove all the other boilerplate code
I found the answer to this problem in the apple developers forum (Can't find the exact link to the post).
You simply have to select the macOS tab when creating a playground.
When you create the playground make sure you select "macOS" tab instead of. "iOS".
This feature is no longer supported in this environment. You can complete this task in the Create ML app. Follow these steps:
Xcode -> Toolbar -> Open Developer Tool -> Create ML -> New Document
Open Xcode menu
Choose Open Developer Tool > Create ML
Press New Document
Select Image Classification
Specify name and a place where the project will be saved
In new versions of macOS, the CreateMLUI library has been deprecated and removed. Instead, create models in CreateML, a developer application inside Xcode.

Xcode Quick Help displays "No Quick Help" when viewing a single file

The quick help feature is working just fine when I open an Xcode project, however when opening a file (e.g. abc.swift) that's not in an open project, the documentation does not appear.
Here is an example:
Install the version of the Command Line Tools for your Xcode
`Xcode menu -> Open developer tools -> More Developer Tools
Restart Xcode. It helped me to see Quick Help again and also fixed git crash.
The below code worked for me. Run the following command from Terminal, then relaunch Xcode.
defaults delete com.apple.dt.Xcode IDEIndexDisable
As an occasional user of XCode, what I still needed to do was download the documentation, which was not installed with the XCode install and/or did not carry over from a previous version of XCode.
From the Preferences dialog, click the Components tab, click on Documentation, and then click the download button for Guides and Sample Code.
Probably obvious for regular users of XCode, but I thought I would write it out for anyone else having this problem, since this was at the top of the Google search.
This is what worked for me. I closed Xcode and then deleted ~/Library/Caches/com.apple.dt.Xcode.
Then I reopened Xcode and checked. It worked after that. I'm currently on Xcode 10.2.1.
It's worked for me, just move the Xcode.app into Applications folder if not exist over here ;)

Xcode 4.6.2 error: "cannot run on the selected destination"

I've been having this problem for a couple weeks now. All of a sudden this happened to my project and I havent been able to fix it. Its a basic tab-bar app and i've barely even started heavy coding on it. Running xcode 4.6.2 (tried on 4.6 and 4.6.1 also).
The actual error says:
"Cannot run on the selected destination
The selected destination does not support the architecture for which the selected software is built. Switch to a destination that supports that architecture in order to run the selected software."
Thanks in advance.
Well here's my new fix: I had (for some reason) changed the highlighted line below:
I had changed the ${EXECUTABLE_NAME} to something else. Changing it back did not fix the issue immediately: I had to first click the + to add a new row then delete the new row.
My app runs fine now
OLD FIX:
OK, so yes, it's true, there are other questions like this one. They helped me figure out a different (and stranger) solution.
I right-clicked on my .xcodeproj file and chose "Show Package Contents"
I then opened "project.pbxproj"
I copied all the text from it to another file, deleted all the text from it and saved
This "crashed" my XCode Project that I had accidentally left open in XCode.
I closed my project, then pasted the original contents of "project.pbxproj" back into "project.pbxproj"
I saved "project.pbxproj" and closed it
After opening my XCode Project again, I was able to run it on my device!
To me, it doesn't make sense why this worked because I didn't modify an files... But it did, so hurrah!
PS
Back up your project beforehand, just in case.
EDIT: Well mine has stopped working again and I can't use the above method to fix it...

iOS5 Storyboard error: Storyboards are unavailable on iOS 4.3 and prior

I've built a small app using storyboards and it ran great. Just before final testing I decided to try it out to see if it runs on iOS 4.3. I clicked on the gray 5.0 in the project settings and selected 4.3.
The app failed to build with the following error message:
Storyboards are unavailable on iOS 4.3 and prior
Both the iPhone and iPad storyboards tell me that.
The issue that when I switched back to iOS5 target, I still keep getting these errors from both storyboards, and the product won't build!
I checked: iOS Deployment target in projects settings is 5.0
Target app deployment target is 5.0
Build settings uses iOS 5.0 SDK
What else do I need to do to restore my project to a buildable state? Is this a brand new bug or am I forgetting something?
Update: I kept getting this error even after doing a clean.
I changed the debugger in Schemes to "LLDB" and did an additional clean, the project now builds and compiles
I also got this problem and finally I solved this by following procedure:
Open XXXXXX.storyboard
Open Identity and Type tab in your right view of Xcode.
Set the value of Development in Document Versioning to "Xcode 4.2" (my default value is "Default Version (Xcode 4.1)".
Change the value of Deployment from Project SDK Version (iOS 5.0) to iOS 5.0, then back to Project SDK Version (iOS 5.0)
Rebuild the project and the error should be resolved.
The solution that worked for me was just to delete the ~/Library/Developer/Xcode/DerivedData directory for my project.
I'm just going to add this one as another possible answer here, as the first solutions worked for me several times (as I mentioned in my previous comment) until today when I couldn't get my project to compile for love nor money with the same error.
With the debugger changed and Xcode set to 4.2 and restarting several times I could not compile. However I discovered another way to get around this issue.
Select the storyboard in the left column and 'Show in Finder' and drag the storyboard to the desktop. Xcode will now change its colour to red and be unable to compile.
Clean the project, drag the storyboard back from the desktop to the directory in finder.
Then, it builds and the error goes away again.
I don't know what triggered the error originally as I'm developing under iOS5 and building for 4.3, but it seems to come up from time to time and.
This seems to be a bug in the latest XCode that I've also run into too, did try the OP's solution of changing debugger and that had no effect.
It cropped up for me since I tried storyboard with 4.3 and then tried to change back.
My solution was to close XCode, open it again and clean. Then I compiled and it worked fine.
Hope this helps others.
While other solutions helped me, they didn't work 100% of the time. I don't know enough about XCode to know how reliable this solution is, but at least it worked for me so you can try it in your project.
In the left hand side of Xcode, open the project navigator. Click the top item, which is your project. In the panel immediately to the right, you'll see a choice to choose between your project and its targets. Click the project, and then in the panel to the right, under the "Info" tab, set "Command-line builds use" to Debug (in my two projects where I was having the error, both were set to Release).
A picture is probably easiest:
Another idea: Open another project with storyboards in Xcode and try to run that. If it succeeds, you can come back to the current project and it should build. I think this clearly indicates a bug in Xcode.
After trying all the answers in here (removing the Storyboard reference, quitting Xcode, cleaning, changing debugger, etc.), none worked (with Xcode 4.5).
The only way I got it to rebuild (and it was a total guess) was to open the Storyboard file in a text editor and delete the following line:
<deployment version="1280" identifier="iOS"/>
It should be near the top of the file, in the <dependencies> section. After that, the project was built successfully and Xcode even re-added that line to the file, but, it still builds...
Go figure...! Hopefully it can help someone!
At last, an elegant workaround that seems to do the trick for me! (I sure hope it works for everyone else. This one's stubborn.)
Once your settings are back safely in iOS 5-land, try Cmd-Option-Shift K (aka "Clean Build Folder..." from the menu - hold down Option to see it), then build.
the solution is simple,
right click your storyboard file, and show in finder
then select the folder where the file is (this would probably be in the en.lproj folder)
right click on the MainStoryboard.storyboard file causing the problem and open with text edit
find the line that reads or something like this:
<development version="4300" defaultVersion="4200" identifier="xcode"/>
and change it to something like this:
<development defaultVersion="4300" identifier="xcode"/>
save the file and build. Et voila...
Ok, I tried everything above and problem still occurred. So I just remove storyboards (as reference not move to trash). then build successfully; after that I added them again; Build, And finally worked.
I was having the same problem. I tried all the above answers and all combinations and nothing worked. Then later after doing some research, I analysed that the simple fact that the error that was throwing at me was straight forward.
Just go to the Build settings and instead of selecting the xcode project file, select the product file and change the Deployment target to 5.0 or 5.1. The error should go off.! I did this in Xcode 4.3 in Lion OSX. It worked fine for me!!
I also had this problem, and nothing helped. Even opening another project and trying to build failed.
What I did, and what for me, was going to project -> info and under "Deployment Target" change iOS Deployment Target to whatever, build and than change back to whatever it was and build again.
Here is yet another random, voodoo, flail that seemed to workaround the bug just now. (after other techniques here had not helped) I renamed the storyboard file (and the entry for it in the info.plist file). Haven't tried the "drag to/from desktop" ritual yet.
Tonight, I have lost like 45 minutes to this issue. grrrrr. Ok I feel better now.
After trying all the suggestions above, without success, I got my code to compile doing the following.
Edit -> Refactor -> Convert to Objective-C ARC
rm -rf $HOME/Library/Application Support/Developer/Shared/Xcode
rm -rf $HOME/Library/Preferences/com.apple.dt.Xcode.*
rm -rf $HOME/Library/Saved\ Application\ State/com.apple.dt.Xcode.savedState
rm -rf $HOME/Library/Developer/Xcode
seems to help with Xcode 4.3.2
Had similar issue. XCode would build and run other projects fine but couldn't get rid of the error on project I had changed, not even backups from server. Tried all the above solutions but nada. Here is what worked.
Uninstall XCode.
Delete user/library/developer/XCode folder.
Reinstall XCode (maybe you should start this before searching for the folder, download took me 20 minutes).
Start up, clean and build.
Worked for me. Saved me some time. Sometimes when the scalpel doesn't work it's time for the hatchet. Now I get to pick a new font to code in (this will clear your preferences)!
The only solution that has worked for me is to create another project without Storyboarding enabled, build it, then switch back to the storyboard project, clean and build.
Here is yet another random, voodoo, disconnect your iPhone if it is connected.
I simple changed deployment target to 4.0 and Development to 4.3 from MainStroyboard.
I clean the project; and restarted the mac, :) i know it sounds funny but restarting xcode didn't helped. maybe there is a cache in memory...
Then i built the project ; it was ok!

Resources