Xcode 9 / Swift 4 migration error - swift4

I'm receiving errors when trying to automatically migrate to swift 4.
I'm getting "unexpected duplicate task" when trying to migrate a workspace with multiple targets.

Had the same error when trying to migrate to swift 4. Check if you did enable the "New Build System (Preview)" under File > Workspace Settings. If you enabled it make sure to set it back to "Standard Build System". Did solve the problem for me.

Reference From BEm answer
I had the same problem. In my app I have three target
Dev
Pre
Prod
App was running in Dev but not in Pre & Prod.
When I open my under File > Workspace Settings, I had below (New Build System(Default))
I changed it to (Legacy Build System)
And it was a fix for me.

Related

Showing Recent Messages error: Could not get GOOGLE_APP_ID in Google Services file from build environment

Just shown up on my Xcode a couple of hours ago and none of the other stack overflow answers are working. Anybody know how to fix this? My project won't build or archive(currently using Xcode 10.2) Thank you!
To fix this error, Make sure you have firebase script above the "Copy bundle resources" in Build phases section of your target in Xcode.
I assume you are using Google Firebase.
As the error say your GOOGLE_APP_ID could not be found.
Solution
Drag "GoogleService-Info.plist" in your project folder. This configuration file is generated when creating your project. If you don't have it you might want to regenerate it again as described on Firebase Console

Swift 4 migration

Good morning,
I have Xcode 10.1 and Swift 3.2
I am trying to migrate to Swift 4.0, but unfortunately I have got these errors:
A. Multiple commands produce '/Users..../path/'
1. Target "ApplicationTests"
2. Target "ApplicationUITests"
3. Target "Application"
B. Cycle in dependencies between targets "ApplicationTests" and "Application"; building could produce unreliable results.
Cycle path: Application Tests -> Application -> Application Tests
Target build order preserved because "Parallelize Build" is off.
Maybe someone knowns how to fix it.
Thanks!
If your app really doesn't have that cycle stated, you might want to clean and rebuild your app. Clean by pressing Cmd + Option + Shift + k and then rebuild/rerun your application. That usually solves some build problems in Xcode.
Edit
Also, you might want to check your Build System to use the new or legacy one. Go to File -> Project Settings (or Workspace Settings) and configure it properly. Try using legacy build system; New build system still presents odd behavior sometimes.

Getting "Error: Failed to connect to OmniSharp"

I'm trying to get VSCode working with my Unity projects, and every time I select the Project icon (the little fire at the bottom) I get the following error:
Error: Failed to connect to OmniSharp
Is anyone else getting this?
You need to download the most recent version of "mono". Open up terminal and pass in brew install mono. Then "Pick a project" and select the ..-csharp.sln file and you should be up and running.
Ok, made some progress and gotten a few Unity projects working. It seems that you need some prerequisites installed, a clean up of your Unity project folder, and possibly some hand editing of your .sln and .csproj files.
I posted a (possibly) better answer over on Reddit. Hope that's not breaking stack etiquitte.
http://www.reddit.com/r/Unity3D/comments/34d6gc/visual_studio_for_mac_help_us_vote_for_unity/
i get this on windows when my project directory has a space in it
i removed the space and removed the error
i expect it will be fixed soom
I have a completely different answer: it's the runtime that VSCode is using. It doesn't match up with what it thinks it needs. I have to remember that we're still in beta and that things are changing rapidly. I had my dnvm running beta 7, but VSCode (and OmniSharp, by extension) is looking for beta 6, so it was failing. I updated my runtime using this this post as a clue. Now I have VSCode 0.7.0 using the beta 6 runtime. I have no idea how to tell what it's looking for...I just guessed based on when they were both released. HTH

how to fix the issue "Command /bin/sh failed with exit code 1" in iphone

I used a cocoa static library in my application. When I compile my library I got the following error:
Shell Script invocation error:can't open input file:
/Users/sijuthomas/Library/Developer/Xcode/DerivedData/SCXML2-
bbttehupryhijphhjdiemcytkvgy/Build/Products/Debug-iphonesimulator/
libSCXMLParser.a (No such file or directory)
Command /bin/sh failed with exit code 1
How can I fix this?
Click On Run checkbox if not selected.
I had this issue because i denied keychain access and in order to solve it you need to open keychain,
Then click on the lock on top right of the screen to lock it again,
after that you can archive and it will work
Deleting "Derived Data" worked for me.
In Xcode go to File > Workspace Settings > Click the arrow next to the Derived Data file path > move the "Derived Data" folder to the trash.
Seems you are running a shell script and it can't find your specific file. Look at Target -> Build-Phases -> RunScript if you are running a script.
You can check if a script is running in your build output (in the navigator panel). If your script does something wrong, the build-phase will stop.
I had same issue got it fixed. Use below steps to resolve issue in Xcode 6.4.
Click on Show project navigator in Navigator window
Now Select project immediately below navigator window
Select Targets
Select Build Phases tab
Open Run Script drop-down option
Select Run script only when installing checkbox
Now, clean your project (cmd+shift+k) and build your project.
Cleaning the build folder (Cmd + Shift + Alt + K) worked for me
1) Delete the pod folder and .xcworkspace file
2) Open the folder in terminal
3) Type "pod install"
Did you add the .a library to the xcode projet ? (project -> build phases -> Link binary with libraries -> click on the '+' -> click 'add other' -> choose your library)
And maybe the library is not compatible with the simulator, did you try to compile for iDevice (not simulator) ?
(I've already fight with the second problem, I got a library that was not working with the simulator but with a real device it compiles...)
In My case there was space in the path that was failing the script.If you are using variables like $PROJECT_DIR or $TARGET_BUILD_DIR then replace them "$PROJECT_DIR" or "$TARGET_BUILD_DIR" respectively.After adding quotes my script ran successfully.
For me, my certificate is expired. I have created a new certificate.
I did all above and spent an hour on the issue.
Tried everything above as well as restarted Xcode.
Finally, restarted computer and everything working normally again!
I tried restarting Xcode (7) and nothing (the have you tried switching it off and on again of iOS development for me :-)). I then tried by restarting my box and that worked.
In my case the script was failing when copying a file from a location to another one. I think it could have been related to Finder screwing with writing rights over certain folders.
For me this error was occuring because I changed the version number from 1 to 1.0 and build number from 6 to 1.1 as I pulled the code from source tree. I just changed it back and changed the build number from 6 to 7and it worked fine.
just put your script in a file and run that file with 2>/dev/null at the end of command line!
This way, if there is a problem with the command whatsoever, it will not halt your xcode build
in my case I was running just a command to uninstall my previous copy of the app from a connected iphone, so it could give an error if the iphone is not there. To solve it:
$mobiledevice uninstall_app com.my.app 2>/dev/null
The only thing worked for me:
1) Delete Derived Data with CleanMyMac: System Junk -> Xcode Junk -> Xcode Derived Data
Deleting Derived Data with CleanMyMac
2) Then in Xcode: Product -> Clean
I'll list things I did that did not work for me and finally what did
First, the accepted answer of Run script only when installing did not work.
Deleting derived data did not work.
What did work:
I added a new build phase in Build Phases
New Copy Files Phase
Drag & Drop the chosen framework into the drop target
Set the 'Destination' to Frameworks
Credit due to Kevin Le's Medium post
For those who doesn't want to uncheck that option (using cocoapods for example), the problem might be with the certificate/key.
Xcode (or whatever tool you are using, like a command line tool) needs to be able to use the certificate/key from the keychain. For this open the Keychain, locate the certificate that you want to use (Usually on login keychain, My Certificates), right click on the key, select Get Info, click on Access Control tab and add the app to the list.
If this doesn't work, try unlocking the keychain.
Another option can be select Allow all applications to access this item instead of specific apps and/or move the certificate/key to System keychain which is shared between all the user accounts on that Mac.
Also check that the certificate is not expired.
1) option :
2) option : pod update, clean derive data,
In my case, one of the script (related to SwiftGen) was failing during compilation.
I fixed the issue by removing the Pods and then updating them again.
Remove the problematic pod under Pods directory or use pod deintegrate
Install / Update the pods using pod install or pod update
P.S. It is possible your dependency is Global and is not in pods. In that case you can also try to reinstall that dependency.
READ THIS IF YOU USE Crashlytics AND ARE HAVING THIS ISSUE...
I was having the same issue as above Command /bin/sh failed with exit code 1 more specifically [31merror: Could not fetch upload-symbols settings: An unknown error occurred fetching settings.[0m
The first solution (enabling the run script only when installing) allowed me to build my target in the simulator, but I could not archive my build.
I solved this Archive issue by enabling Crashlytics on firebase. I am still used to Fabric where Crashlytics is automatically enabled. Once I enabled Crashlytics in the firebase console for the corresponding GoogleService-Info.plist I was able to Archive without this error.
Remove all pods and install again.
Steps:
comment all pods and run pod install
uncomment all pods and run pod install

Xcode 4 Preview 4 displays "Build Succeeded" but with errors

Xcode 4 Preview 4 displays "Build Succeeded", as show the image below there are 5 erros. Actually there are more than 5 errors, but it seems that Xcode doesn't build anymore. It happened when i built the project in xcode 3 while the xcode 4 was open with the same project. Anyone have an idea to overcome this bug and reestablish the Xcode??
I tried to restart the Xcode, restart the mac. I don't know how to clean up the build. The "clean all" option in Product menu is unable.
Thanks in advance.
Follow these steps:
Edit your PCH file
Save it again.
Clean and build
No 4th step.
Hope it helps!
Try going into your Build directory and simply deleting everything.
For Xcode 3, the build directory is usually located inside your main project folder. For xcode 4, as discussed in this question, can be found, by default, in ~/Library/Developer/Xcode/DerivedData.
Also, be aware that you won't be able to clean a target if it's running inside the simulator (though it seems like that doesn't apply in this case.)
I just got this error today and want to explain what I did in case anyone else encounters it.
Xcode would display errors but the build would be successful and run in Simulator. I created a new project from scratch and the same thing happened. I'd insert random lines like "saedrw34" and it would highlight it with the red exclamation point. But the code would still build and run.
Check the autosave settings:
Xcode-->Preferences-->General: Auto-save --> Set to Always.
I remembered that prior to my problems I had changed it to "Never." I didn't realize Xcode, when you hit Run, compiles the latest saved version on your hard drive, not the current version you see on the screen. So basically, it was building a different version than the one with errors.
May be different from your situation but thought I'd just pass it along..
For me the following worked:
Got to the "File Inspector" and uncheck the targets under "Target Membership"
Build the project (maybe also clean build)
Check the unchecked targets under "Target Membership"
Build the project