SwiftUI builds successfully but preview fails - swift

I'm on the latest OS and Xcode version (11.2) and for some reason my canvas just will not build. I keep getting X is not a member of PROJECT error. It's driving me insane. It was working not that long ago and I have no idea what changed to make it fail like this. I've also tried deleting Derived Data, restarting laptop...
I've made sure that all my files are included in my target and everything looks like it should be working properly, the app itself builds perfectly fine it's just the preview

The solution to my problem was that I had a file within my project named the same as my project name. The error messaging was not useful at all in solving this, but once I had renamed that file, the preview began working again.

So I had this same issue except I found out it was because I have custom build configurations and it didn't like the custom module name Xcode made. The solution was to rename the module to the same thing as debug and release in Build Settings > Product Module Name
I hope this helps someone

Related

No such module error after copy

I have a working Xcode project, with cocoapods. I made a copy of my project to do some testing of new code. This was done to still be able to fix bugs, in the original, that users point out. But after i copied the project i can't build and run it anymore. The issue is a cocoa pod, SearchTextField to be specific, i get the error message 'No such module'.
To clarify, i didn't change any code yet. Just did a copy of the project and tried to run it.
I have done a clean before the build, but it did not help. Also i have reinstalled my pods, that also didn't help.
Why is it that i can't copy my project and run it? Could anybody, at least, point me in the right direction?
EDIT:
I now use the SearchTextField class without importing, by moving the swift file into my project. But now i have the same problem with IDZSwiftCommonCrypto, i think something is seriously wrong with my project. Removing and reinstalling of the pods does nothing.
Now i gradually disabled als imports and it seams like i have the same problem for all my pods. I think Xcode doesn't look at the right place for them, is that possible?

App Testing iOS Xcode Swift

Well, I have looked through a lot of questions with the several problem, but one of them was helpful.
I am using Pods and everything runs well, when I run the project and try it out on my device - it runs perfectly, but when I do testing, it says an error.
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/usr/include/libxml2/libxml/xmlreader.h:13:10:
'libxml/xmlversion.h' file not found Could not build Objective-C
module 'libxml2'
"libxml2" that I'm using is running fine in my project, my app is fully functional, but then I do the "testing" then it collapses.
I did add /usr/include/libxml2 to the Search Path header in Build Settings. Changed scheme and did clean & build and then change back. Tried re-installing/updating pods. Then deleted the DerivedData folder in ~Developer/Xcode/
but still no luck at all
I have struggled on this problem for several hours now...
Suggestions?

Three20.h file not found when building with xcodebuild

I build my project(include subproject Three20) successfully using xcode GUI,but when I use xcodebuild,it failed with this below:
/Users/***/MyProject/Classes/ComposeSMSViewController.h:14:9: fatal error: 'Three20/Three20.h' file not found [1] #import <Three20/Three20.h> 1 error generated.
my Header Search Paths are $(BUILT_PRODUCTS_DIR)/../three20 and $(BUILT_PRODUCTS_DIR)/../../three20 and Classes/Three20/Build/Products/three20
That works on GUI building but failed on xcodebuild.
How can I solve this? Thanks
I think you should restart three20's install , it need several steps and make sure it's without mistake. Best regards. It may help you: http://three20.info/article/2011-03-10-Xcode4-Support
If it still doesn´t work (and an error like "Three20.h file not found" is shown), try setting "Skip Install" to "Yes" for all of the Three20 dependencies and projects in your app (except your main project): graphically . This onle creates an .ipa for your project, but not for your three20 projects.
I resolved this issue today by accident. I tried all the solutions I found online and it didn't work. I was pretty confident that the problem was within xcode because the app built fine on my boss's machine. Turns out my scheme name didn't match my target name. This was a result of duplicating a target, which automatically named my scheme to "myapp copy". When I matched the scheme name to the target name, everything worked fine and the three20.h file was found. Hope this helps anyone with similar circumstances.
Product-> Manage Schemes... and rename the file

XCode 4 problem, always showing target view when stops at a break point

I just upgraded to XCode 4.0.2 and ran into a strange issue. Every time when the app stops at a breakpoint, XCode shows the target view instead of the .m file. When I manually click the file and show it, and click step, then the IDE switches to the target view again. This makes debugging virtually impossible. THis only happens to my own project. Sample projects work fine. Please help, it drives me nuts and I can not find where did I get the settings wrong.
P.S, this project worked fine on XCode 3, after upgrading to Xcode 4 I had problems with my targets. After wrestling a while with the schemes it finally builds and runs fine, but I can not do debugging when making changes because of this. I am not sure if I messed up some settings during the time to change the scheme and target settings.
Thanks
Ray
Ok, found the problem, but still not having the real solution. The situation is that the project was originally in one directory called WorldClock, after having problems when installed XCode 4, I copied the folder to another folder called WorldClockNew, and started in this folder. However somehow the build directory is still pointing to the old directory. After deleting the Build folder under WorldClock, this problem went away. However I still can not find where in the XCode settings to correct the Build path..

Receive message "A signed resource has been added, modified, or deleted" when trying to debug an App on iPhone

While attempting to debug a build created using the 3.2 SDK on an iPhone device I receive the message "A signed resource has been added, modified, or deleted.".
I can clean, rebuild, then install with no error, but if I try to install without cleaning the error shows.
Anyone have an idea as to what might be causing this?
I found a workaround for the bug.
If you delete the .app file in build/Debug-iphoneos/ before building for the device, the app gets installed without errors.
And there is a simple way to do that before every build.
Make sure you have selected "Device" in the dropdown overview menu.
In XCode go to Project > New target...
Then find "Shell Script target" under MacOSX/Other
Name it and add it to the current project
Now, in the left navigation panel, under targets, expand your newly created target and double-click on Run Script.
In the window that opens replace "# shell script goes here" with "rm -fr build/Debug-iphoneos/*.app" (without the quotes).
Now open your main target preferences and under Direct Dependencies add your newly created target.
Build and Go! :)
This error occurs when there is a special character in the Product Name. In my case it was a "?"
If you change the Product Name it automatically updates the "Bundle Name" and "Bundle Display Name" so it is often the best choice to rename an app.
If you want to include special characters in the app name you have to manually rename the "Bundle Name" and "Bundle Display Name"
Bundle Name: This is the actual app bundle name in the file system such as "Awesome App.app". It is generally not visible to the user.
Bundle Display Name: This is a short name displayed under the app icon on the device. Since the bundle name would be truncated to "Awes…tion" you have the option to have a shorter name which fits better such as "Awesome App". It should be similar to the App Store name (set in iTunes Connect)
This is pretty clearly a bug in the 3.2 SDK, but I don't want to downgrade. I've found that doing a Clean by pushing Command+Shift+K, then Return is pretty fast before pushing Command+R to build.
Xcode 8, reason of the "A signed resource has been added, modified, or deleted." was that target was signed with an enterprise provision profile.
In my case, it happened when no changes were made. Make a change to any file and run again.
This can have several causes. The fastest way to figure out what is causing it is to go into Xcode, Window menu, Devices, then click the reveal button at the bottom of the pane to show the Console. Now attempt to run. You should see log output that names the specific files it is complaining about.
Most of the solutions previously posted are just artificial ways of getting Xcode to regenerate the contents of the build folder and/or re-sign the files.
In my case, my WatchKit extension was somehow acquiring references to Cocoapods frameworks that were only targeted toward the main app so they got signed during the build, then pruned later (as they were not used). Then on device, iOS complained that they were missing from the .appex folder for the extension. I ended up not needing any pods in the extension so I just removed them all and removed the extension as a target, then did some minor cleanup to remove the pod-related debris left in the build steps. Now everything works perfectly.
(SOLVED) This is a weird one. I tried everything I could find. Eventually I changed the product name from "Unit Tests (device)" to "Device Unit Tests" - removing the brackets. Now everything works. The spaces in it appear to be fine.
Previously on stackoverflow:
I've just run into this bug with two static library projects. One builds and tests using the GHUnit test runner on the device without a problem. The other projects will not install and gets this error. That means it's something thats different between these two projects. I've so far tried wiping the build directory, taking spaces out of the executable name, and various clean and builds as suggested here.
Same for me, thought it has something to do with multiple targets etc. because I changed a lot there. But it's highly possible that it's a Bug in the 3.2.2 release since I did not test extensively in this sdk version before the massive target changes in my project.
solved my issue!!!
I found out by accident that somehow a space " " found it's way into the Product Name of my app so it was called "First Second.app" instead of "FirstSecond.app". After deleting the space the issue was gone!
I changed it here:
right click on target
Get Info
Build Tab
Packaging Section
Product Name <- The name here will be used for the bundle (.app) name
Hope this helps, let me know!
Cheers,
nils
I could solved by changing project name.
[project]-[Rename] menu. "phase1 (new)" -> "pahse1"
I was getting this same error, but intermittently. I tried all the above and it still didn't work. Today I found what was causing it.
The error seems to occur when editing a xib in interface builder. If you try to run while the interface builder is open in xcode it will cause the above error. To solve just close the interface builder editor. i.e. just select a code file from your project so you are in the Source Editor.
The simplest (and probably most common cause) appears to be rebuilding without any changes.
So the simplest thing to cure it is to make a trivial change to a source file (such as adding a space, then deleting it), and then rebuilding.
If this doesn't work, feel free to try all the other answers here.
For months, I'd get this error without realizing it was due to such a simple cause. I'd usually do a Clean Build to get rid of it.
When I created ipa through terminal using xcodebuild commands, ipa created but while installing it I was getting same error. exportOptionsPlist solved my issue.
xcodebuild -exportArchive -archivePath projectPath/myapp.xcarchive -exportPath projectPath/myApp.ipa -exportOptionsPlist ProjectFolder/exportPlist.plist
In my case, Quit and restarting XCode worked.
For me the issue was related to the provisioning profile settings. The clue to this was that debug builds were installing ok, but release builds were not. I wanted to test a release build, so I ran the scheme with that build configuration.
I fixed it by duplicating the Release Configuration, then modifying those fields in the Build Settings to have the same provisioning stuff as if I am debugging it.
(Adding another build configuration will give you headaches if you are using Cocoapods however, then you'll have to modify your Podfile)
I'm getting the same thing, when installing on a iPod Touch. I can't link for the simulator (for other reasons), so can't say whether the problem occurs there.
Yes, rebuilding clean or deleting the app from the device allows me to install again. Neither are desirable, iterative solutions!
The minimal "cleaning" I've come across as a work around is manually deleting the Foo.app in the build/Debug-iphoneos directory.
it seems this is a bug in xcode 3.2.2:
iphonedevsdk
I had the same problem in Xcode 3.2.1 when I put a + in my app name. Specifically the "product name" in the build settings. It is fine to have a + in the bundle name in your Info.plist. The same probably applies to other punctuation characters.
Go to Window > Organizer > Projects > Find your project and delete derived data
I got this error intermittently while installing app using iPhone config utility on Windows7. Following solution works - Go to C:\Users\{lanusername}\AppData\Local\Temp and delete app specific folders (e.g. abc.app) and try installing app again.
I reported this bug on ICU (Windows versions) to Apple in June 2011. With the following workarounds:
The workaround is this ....
Win XP
1) Close ICU
2) Delete the temp folder: c:\Documents and Settings\[username]\Local Settings\Temp\[AppName].app
3) Delete the deploy folder: c:\Documents and Settings\[username]\Application Data\AppleComputer\MobileDevice
4) Restart ICU. Drag in the App and install normally.
============================
Win 7
1) Close ICU
2) Delete the temp folder: c:\Users\[username]\AppData\Local\Temp\[AppName].app
3) Delete the deploy folder: c:\Users\[username]\AppData\Local\Apple Computer\MobileDevice\Applications\[AppName].app
4) Restart ICU. Drag in the App and install normally.
=========================================================
I simply rebuilt my app, and that solved the issue.
I also faced the same issue. After wasting lot of time I realized that my product name has a special character "?" which cased the problem
Having the DerivedData folder at a network location caused this problem for me.
After trying everything else, I found out my workstation couldn't agree with the University server about what the time was. (It thought everything was always modified). I also had to clean for every rebuild to avoid that frustrating message.
In the end I gave up and built locally, changing Xcode > Preferences > Locations ... feeling altogether pretty dumb for having ever built over the network.
We ran into this issues on XCode_6.3.1. We were building a AppleWatch app, with an extension. We do have a bunch of Pods.. After debugging the issue for almost a bunch of hours, what we found was that there was an issue with the way a file was adde to the project..
It seems like some references to a unused file was sitting in the iPhone App, though it was used in the Watch App.. It turns out that the error XCode was showing was totally useless.
After removing this file and re adding it back to the project the project started working fine & was able to install to the device. To make it even harder to debug the issues, the debug version was installed without an issue, but was unable to install the norman version..
Make sure you add your files to the right target and, look at git history and see if there are lingering fragments that are added to the wrong target.
This is a very general error message indicating something is wrong during the validation process of the code signature. To find out the specific error, you can go to Xcode->Window->Devices and check your device log.
In my case, I have following console spew
Feb 1 18:53:07 iPod-touch installd[40] : 0x1001f8000 -[MICodeSigningVerifier performValidationWithError:]: 192: Failed to verify code signature of : 0xe8008017 (Signed resources have been added, removed, or modified)
Check on this 3rd party framework again, I found an extra CodeResources file under the framework root. Remove that file fixed the problem.