How can I prevent "No such module 'Alamofire'" as an error in Xcode? - swift

My Xcode keeps giving me the error "No such module 'Alamofire'" even though I've built and run it a few times, on this project. It seems like this happens randomly. I can usually solve it by quitting Xcode and reinstalling my pods in the project. However, this is annoying and a waste of time. Is this something other people are dealing with? Did I install it improperly? What is going on?

Sometimes I also encounter this problem. In my case, this is due to lack of disk space on mac os. When I free up enough space this problem is solved.

So, I got the same problem with a different pod, Realm Swift. The answer to this was to go into Product > Scheme > Manage Scheme, then uncheck everything but the pod. After that, I built the project successfully. Then I went back into Manage Scheme and checked my project and unchecked the pod. I had to try a few different combinations before I got one working, but this solved the problem.

Related

Visual Studio Code keeps crashing while working

My visual studio code seems fine and all of the sudden boom its crashed. Searched google for the error code No solution found. Any help would be appreciated.
error code = -536870904
Whenever anything stops working for no apparent reason then think:
Did it work before?
No, it is new or it has not worked yet.
Check your download, ensure it is compatible with your operating system and other running programs.
Yes, it used to work, but now it doesn't.
Look at the next step
Did you recently update the program, your operating system or any other programs?
Yes, I updated something.
Try rolling back your updates to see if it works again. New versions of software tend to be more error prone than the older, established versions.
No, I don't think I changed anything.
Either you are unaware of changes made to your system or some subscription has ran out. At this phase, the best option is to use common sense or uninstall and reinstall.
Another issue that you might be having is if you're running too many programs at once and your computer is force closing programs to protect itself. Try monitoring your Task Manager you may see a spike right before the crash. Also, make sure the crash isn't caused because of trying to run code (especially with code that has infinite loops)

Advice to fix 'No such module' issues for pods in Xcode project

I'm facing this No such module 'SomeModule' error in an XCode solution that I've inherited from some other developers. Initially the error is No such module 'ObjectMapper', but I find that if I swap the position of that line with the one below, it becomes No such module 'Alamofire'.
I've tried all the simple things suggested on this site (and others), making sure I'm opening the .xcworkspace file, deleting everything and re-installing (derived data, the whole Pods directory, etc.), updating cocoapods, etc.
I suspect that what's actually going on is that either the pods themselves aren't building, but for some reason the errors there are making their way to XCode's obtuse errors list, or that they are building but somehow not being linked correctly.
This is actually a project I've inherited from some other developers, so it's hard to know what weird or wonderful configuration they've done to break things. They are using an approach that I've not seen before where there's 3 build schemes for different environments (in this case Develop, Stage and Prod) then this kind of parent scheme for all the other three.
I've also tried going to 'Manage Schemes' then ticking the 'Show' checkbox for the Pods-Sunflower project. When I try to build just that project, I get a bunch of errors (mainly for Facebook, Google and Realm pods) that say things like:
Unable to load contents of file list: '/Target Support Files/FBSDKCoreKit/FBSDKCoreKit-xcframeworks-input-files.xcfilelist'
I don't expect anyone will be able to provide me a set of steps on how to solve this issue (I mean, that would be great), but I am hoping that someone can help me find ways to just work out what the problem is here, like:
How can I verify that all the separate pods are actually building?
Is there some folder where I can see all the built pods?
When you get a No such module 'SomeModule' error, where is Xcode trying to find the modules (like, in the file system? where?)
Thanks. I know this is one of those perennial issues, appreciate any advice.
The solution which worked for me was:
First thing i do when i got project from another developer is make a copy of pods and completely delete following files
Podfile
Pods folder
Podfile.lock
xcworkspace
In case you already once use that same project try deleting derived data
After deleting pods, reinstall pods and open project and let xcode do indexing of your project and after indexing look left side where warnings and errors shows, In there sometime you just have to just click and update or convert whatever xcode suggesting.
Note: - Sometimes doing same thing doesn't work try changing sequence because its xcode sometimes become dumb. Also try restarting
Honestly in these situation all i do is hit and try.
But above steps generallt works for me.

Publish to Glassfish server stucks at 15% and all the other progresses are blocked

When I try to run a project (Only this project and others work fine), it always stucks at the publishing(copy and paste point). It can work perfectly fine until one time I(not sure) accidentally click incrementally publish and then stop it forcefully. Then this problem persists. I try to clean the server and also try to empty the domain folder but none of them works. It is like very strange bug.
I don't want to try creating a new domain since I have add JAAS configuration and JNDI in this domain. Or can anyone tell me how to import the configuration into a new domain?
If I wait long time for it to finish, random problem occurs:
The problem is other project can be run in debug and this project also can previously. It is all just out of sudden when I forcefully stop some process in eclipse tho I am not sure whether it is because of.
This is so annoying and can anyone give some constructive advice? Thx a lot!
Anyone encountering similar situation and sharing his/her experience here will be appreciated. It does not have to be exactly same and any lead or hint are welcome, please.
Actually, I think it is definitely an eclipse bug.
Creating a new workspace and importing all the related projects and glassfish servers can solve the problems though I don't know the actual reason.

Xcode won't build to device

This problem has been KILLING me. I've been working on this app for 8 Months, and I am so close to finishing, I just can't seem to build for device. Building for the simulator works fine, but device always gives me the SAME 2 errors.
The 1st Error:
"Instruction requires a CPU feature not currently enabled"
From googling, I've found this probably means I'm not linking a binary I should be, but I'm not sure.
The 2nd Error:
If you can't read it, it says: Generating JWFNS.app.dSYM ... error: unable to open executable '/Users/ajr1188/Library/Developer/Xcode/DerivedData/JWFNS-azshgysfabycfagnebotitpcyaww/Build/Products/Debug-iphoneos/JWFNS.app/JWFNS'
This is the big one. I cannot seem to build the .app.dSYM file properly. I went in and deleted the build folder, I looked at EVERY stackoverflow question I could find and tried changing any random thing mentioned in another question, but all of it is to no avail. I'm so suck right now. AHH. PLEASE. Any help would be so appreciated!
Maybe your project has become hopelessly corrupted. One thing to try is to start a brand new project and copy/import all your sources/assets into the new project to see if that fixes the problem.
Another less nuclear (but perhaps more time consuming) approach is to binary search the build. Exclude absolutely everything except main.m and see if that fixes the problem. If it does, include half your sources, and buid again....repeat, trying to narrow in on the problem spot. Maybe a file or group of files has received special build settings that don't belong there.
I've had very similar problems, I cant remember the exact error message but it was very similar. Are you able to make a new project that will run on your device?
if so (and I know this sounds bad but it's worth a try) Create a new project and simply copy all the code and resources across and see if it still works. If it doesn't then there is something wrong with you code and you can continue trying to isolate the problem from there.
Hope this is helpful.
check the frameworks you link to. there's a chance that you linked a framework (say quartz) of osx, instead of ios.
Answering in detail is probably going to take looking at your target settings. But it looks like you may be building for the wrong architecture. (It doesn't link, so there is no .dSYM symbol file.) For example, if you have only recently built for device, you probably created your project under an older Xcode, and it may not have the arm6/arm7 settings right.
To check, show the Build Settings for your target (not the project), and filter on Architecture.
Make sure that in build settings the architectures are armv6 and armv7. Also make sure that in .plist file, the "Application requires iPhone environment" is TRUE. Delete "Required device capabilities" in the .plist if present.

iPhone: Failed to launch simulated application: Unknown error

This is a new iPhone project, only 1 target (different from this question)
On build we get:
Failed to launch simulated application: Unknown error.
The google again gives us nothing, lots of people have encountered this and there are lots of crazy ideas to try "oh clean the build", "clear the cache", "twiddle this flag" and none of them work and work consistently. We can reproduce this on two different machines with SDK 2.2.1 and 3.0 beta. Not the install on the machines since other iphone projects work just fine so we believe it has something to do with the config of this particular project but after combing through the config twice we can't spot the problem.
Vanna, I'd like to buy a clue for $200 please.
Tried: XCode menu->Clear cache
Tried: clean all targets
Tried: rm -rf ~/Library/Application\ Support/iPhone\ Simulator
This happened to me once and I think I saw in a blog to simply quit and restart Xcode. Miraculously, it worked for me. I doubt this is the end all solutions to all problems like these though, but if you haven't yet closed Xcode, it's worth a try.
I sometimes see this problem and it is fixed by rebooting the maching. I suspect the internal state of the simulator gets screwed. Doesn't sound like your problem though.
I agree with MiRAGe; if this persists, start a new project and import your source.
If other projects work fine; start a new one and copy the files. Combing through configs just won't do it (since XCode has, well, thousands of config possibilities).
You can send me a check with the $200.
P.S: When you actually do start a new project, do it step by step. Run it after each change. Maybe you will find your problem. It might be a ton of work, but it might also help the other thousands of lost souls who have an 'Unkown Error'.
Changing the product name worked for me. I tried several different alternatives and all of them worked fine. It was the "magic product name" I used at the onset that failed every time I went back to it. YMMV.
This might be because items are missing for the target. Expand the target and verify that all needed source files and libraries are there. Restart Xcode after you've messed around.
alt text http://pici.se/pictures/TsnTQxhKh.png
Thanks ...Did have the same problem or worse. My app wasn't loading in the simulator, alternatively sometimes the build failed. Now realized it's pretty logical.
When you create a new project and info.plist get associated with the project.
Each time you add a modify/add the target another plist is generated with the new name.
But the original association with the info.plist is still around and there's a conflict.
So remove that association from the current target or better still remove from project and trash the info.plist.
Just make sure in the target settings(do getInfo) the correct info.plist is mentioned.
Note the name for product/target should not have spaces. If you really want it change the bundle display name.
Now the only reason why xcode should be closed is to ensure the project file has registered all changes.
I got this problem when I added the .plist to my target (Info.plist -> Get Info -> Targets -> Target Memberships). It went away when I unchecked it again.
I see that that's separate from the Targets -> -> Get Info -> Build -> Packaging -> "Info.plist file" -> my.plist that trips mentioned, but I still don't really understand what's going on, and definitely don't understand why we get such an unhelpful error message.
I've had this twice for the same reason: adding a folder called Resources to the project. This is a naming conflict with something (though there is nothing called "Resources" in the application bundle by default). It might be that mysterious naming conflicts are a common cause of this problem.
To fix I renamed the folder to something else ("Assets"), manually deleted the entire build folder (clean didn't work) and quit the simulator.
Another thing to try if you are desperate is to change the 'Product Name' setting. This worked for me once when everything else didn't.
I had the same problem because I had changed the BundleName and some other values but not changed the PRODUCT_NAME. I had problems finding where PRODUCT_NAME is defined: Get Info on the target, Build-tab and it is down the list somewhere.
I changed PRODUCT_NAME to match the bundle name, restarted Xcode and it worked.
Fred
I had this problem recently and the fix was ridiculously simple. I remembered that I had been editing the target settings and under the "Properties" tab in the "Executable" field there was a space after the value which was ${EXECUTABLE_NAME}. Yes, a single space. It was impossible to see unless you highlight the field. I figured this out because I had edited that field seeing if I could add a command line option that way. I guess when I cut the additional option back out, I missed a space. So while this is the only possible cause of this problem, it's worth checking out.
Had same problem. None of the answers above worked for me. Then i remember i had just added the icon to the Resources folder before the problem started. Moved icon to Other Sources folder and it worked. Weird!
Thanks Guys.
I had the Product name different than in the info plist. A restart once I fixed that made it all go away.
ps, stackoverflow has been a real help to beginners like me. Thanks from downunder.
I add this issue with a folder named "resources". Rename it, clean every thing and run again.
1) Restart Xcode;
2) Use "Get Info" on Info.plist and uncheck current target (Info.plist would be added anyway).
That's all.
I can confirm that a naming conflict was the source of our problem. We had a filesystem folder named resources inside the Xcode group named Resources. Sometimes we would get the error and a system would lock up and sometimes it would not. Changing the folder to the name assets resolved our problem. After reading some of the above comments - it appears that Xcode group names can clash with directory/folder names.
This happened to me when I changed my version number from 1.0 to 0.1. When I changed it back it started working again.