Problems running on iOS - macos

I've tried on 3 different computers but it still has the same problem that prevents me from running the project on the Mac. When I use Windows and connect to my Mac to run, it shows the same error on all 3 computers.
The error message displayed:
Can not resolve reference: /Library/Frameworks/Xamarim.iOS.framework/Versions/Current/lilb/mono/Xamarin.iOS/Facades/System.Memory.dll

Quick fix steps
VS on PC:
in iOS poject open References list
find Xamarin.iOS and check the path in properties
open containing folder, open Facades folder, copy System.Memory.dll
Mac:
open Finder and Go > Go to folder... > type Library
find:
Library/Frameworks/Xamarim.iOS.framework/Versions/Current/lilb/mono/Xamarin.iOS/Facades/
paste System.Memory.dll
.. rebuild and you are good to go

From what I understand, this is usually do to a pending update for Xcode.
Make sure Xcode is installed and updated. Once it is updated, launch Xcode to ensure that all updates are finished(I don't know why, but a lot of times you have to run Xcode for the update to finalize.)
Then clean and rebuild your project. That should fix the issue.

Related

How do I Compile a Framework in Xcode?

Ever since I switched to Yosemite, I have been getting an Xcode quit unexpectedly error whenever I try to run SDL2. I can't even get a "hello world" to run.
I am trying the fix it by following the directions on this page:
Xcode 5 crashes when running an app with SDL 2
But I don't know how to "Compile the "Framework" target in Xcode/SDL/SDL.xcodeproj" I tried just simply building it but that doesn't seem to work because I don't see any framework file showing up.
Can someone help me figure out how to get rid of this error?
I assume you have got the latest version of the code either by doing hg clone http://hg.libsdl.org/SDL or by downloading the latest snapshot from https://www.libsdl.org/hg.php
This should give you a directory called SDL which contains the source and all of the projects. You will want to open 'Xcode/SDL/SDL.xcodeproj'
Then ensure the following is set as your build target - Framework > My Mac (64-bit) You can change it by clicking on it.
Then hit CMD+B (or select Product->Build from the menu) to build the framework. You will then be able to find the SDL2.framework in the following location:
/Users/*yourusername*/Library/Developer/Xcode/DerivedData/SDL2-*randomstring*/Build/Products/<*Debug/Release*>
Copy the framework to /Library/Frameworks

xcode 6 beta 7:A signed resource has been added modified or deleted.

When I'm running the application on device aftercleaning, removing derived data, first time it runs without any issues.
Second time when I'm trying to run, it say's "A signed resource has been added modified or deleted."
On the simulator app run's without problem.
I think it's because of extensions, I have editing, share and today extensions, when I'm deleting this extensions, then I can run second time without this message.
The problem has been since from xcode 6 beta 5.
Maybe issue related to provisioning profiles and signing ? I has created different provisioning profiles for each extension target.
So my question is, how can I fix this ? How can I run on the device second time without cleaning project?
It is still not fixed in XCode 6 RTM. But I found an easy walk around. Simply delete the ShareExtension.appex folder under your build. Then rebuild again. You don't need to clean project, so rebuild is quite fast.
A actually alias the command to do the cleaning
rm -rf ~/Library/Developer/Xcode/DerivedData/<your_app>-*/Build/Products/Debug-iphoneos/ShareExtension.appex/
I used a slight modification of Cloud Xu's script to delete both the .appex and .appex.dSYM
rm -rf ~/Library/Developer/Xcode/DerivedData/YourAppName-*/Build/Products/Debug-iphoneos/com.yourcompany.Name.extension.*
You can put this in your scheme so that it executes with every build:
Edit scheme... > Expand the Run mode in the sidebar > Pre-actions > Click '+' > New Run Script Action.
Edit:
There is an another workaround: for each extension target containing .swift file, add build pre-action in project running scheme configuration:
touch "${PROJECT_DIR}/SOME SWIFT FILE IN EXTENSION.SWIFT"
So I've found a workaround for this issue. For now we can't have swift code in extensions. As mentioned in the comment
When removed all extension targets that contains swift code it's started working normally. I think it's a bug in xcode, for now if we have extension with swift code, don't know why, but second time run gives "A signed resource has been added modified or deleted." error.

Crashlytics file not found

Recently opened a project that I had compiled and submitted to Apple.
I haven't touched it for a couple of months but I'm getting this odd compile error at:
#import <Crashlytics/Crashlytics.h>
The error reads:
'Crashlytics/Crashlytics.h' file not found
Clearly the framework can't be found but I'm puzzled as to why, when the project was working a few months ago, it's suddenly stopped.
Any suggestions why?
Xcode: 4.6.3
Mac OS X: 10.8.4
Just add $(SRCROOT) to the Framework Search Paths in Project Build Settings (Search Paths).
Crashlytics installation process drops its Crashlytics.framework to your project folder (or creates the symlink).
If you moved Crashlytics.framework somewhere deeper in the project folder hierarchy - set 'recursive' to the right or just point directly to its parent folder in Header Search Paths:
$(SRCROOT)/Path/to/the/folder/containing/Crashlytics.framework
Delete frameworks from you project and disk. Check that you have the newest version of Fabric plugin.
Copy frameworks from plugin folder to desktop with this commands:
ditto -xk ~/Library/Caches/com.crashlytics.mac/5b91b14e832a7b1c29441ec5ba109810/sdks/ios/com.twitter.crashlytics.ios-default.zip ~/Desktop/
ditto -xk ~/Library/Caches/com.crashlytics.mac/5b91b14e832a7b1c29441ec5ba109810/sdks/ios/io.fabric.sdk.ios-default.zip ~/Desktop/
Add frameworks from desktop to your project.
Info from: https://twittercommunity.com/t/error-upgrading-from-crashlytics-on-ios/36196/2
I'd recommend just using CocoaPods to add the Crashlytics framework. No need to care about paths anymore.
Podfile:
pod 'Crashlytics', '~> 3.4.1'
Script Build Phase for dSYM Upload:
./Pods/Crashlytics/iOS/Crashlytics.framework/run <your_crashlytics_id>
Import:
#import <Crashlytics/Crashlytics.h>
For me, this worked:
Remove the fabric and crashlytics frameworks from your project, and delete the files from the disk for our project.
Comment the lines in your appdelegate.m file, if you added them for the following:
import Fabric/Fabric.h
import Crashlytics/Crashlytics.h
and
[Fabric with:#[CrashlyticsKit]];
In the fabric app, choose "New app", and select your Xcode project file
Recopy the build script and build as instructed. The build step is why you needed to comment the lines above-- it won't work if you leave those lines in.
After the build script runs, it will prompt you to drag the frameworks from the app window into your project navigator. This will copy the latest versions of he frameworks (which include the .h files) into your project
I have tried manually downloading, and copying from other projects, but this is the only way I could recover after losing the frameworks files for an app.
In my case, the Framework was in the project folder, but not in the Project Navigator. I dragged it to the project and everything worked fine.
I've had this issue working with distributed teams (through github) after checking in then checking out Crashlytics. The Crashlytics.framework will only have one folder inside it -- "Versions". You need to save a version of the contents inside Crashlytics.framework to another location, then copy-paste them into Crashlytics.framework later.
Remove Crashlytics.framework from the project and disk. Copy and add it again. It helped me.
In my case, I was migrating from an old Crashlytics install through the Mac app to Cocoapods. A lot of the answers to this question recommend completely removing everything and starting over. I started doing this and noticed a discrepancy between code found in Fabric's documentation and the code shown in the Fabric app during the step where it tells you what to copy into your Run Script Build Phase.
Fabric's documentation has double quotes surrounding the entire string: "${PODS_ROOT}/Fabric/Fabric.framework/run <Your_API_Key> <Your_Build_Secret>"
The Fabric App only had double quotes around the path to the run executable: "${PODS_ROOT}/Fabric/Fabric.framework/run" <Your_API_Key> <Your_Build_Secret>
So before you delete everything and start over, try updating your Run Script Build Phase to this:
"${PODS_ROOT}/Fabric/Fabric.framework/run" <Your_API_Key> <Your_Build_Secret>
I have changed the name of the working folder and Craslytics fails. Check this in Build Settings (Search Paths).
Good luck!
I have tried to play with the frameworks search path and relocating & reconnecting the framework file; checked the build settings (Link binary with libraries section) but the error persisted.
Finally, I have reinstalled the framework, which only takes 2-3 minutes. The problem might be caused by that you have relocated the Crashlytics.framework to another subfolder from the root directory, but I am not sure about the exact reason.
Delete everything regarding to the Crashlytics
Start crashlytics app, login and select your project
Add run script
Drag & drop the .framework file (I have kept it in the root folder)
Add the import and startWithAPIKey statements back
Completely Remove the Crashlytics Frameworks on your proj include the shell script in App Build Phases Run Script.
Reinstall the Fabric follow the guide,everything will be OK.
I had previously upgraded to Fabric and had no issues. A couple of days later, I reopened the same project and had the missing crashlytics.h file problem.
I couldn't simply reinstall from the plugin due to a non compiling project (I had so many CLS_LOG messages and references to the missing crashlytics.h file in my project, it would have taken a long time to remove them just to allow the build to work - refactor wouldn't work on CLS_LOG).
So instead, I deleted the crashlytics.framework from my project and did the following to reinstate it from the plug in directly:
Download the Fabric plugin again and double click the zip file to unpack the Fabric application.
Right click the Fabric icon and "Show Package Contents"
Copy the Crashlytics.framework folder to your Desktop and then re-add it to your project via File -> Add Files to ....
If step 3 doesn't work for you, you can also add crashlytics.framework to your project folder on your computer directly, and then also add it into your project list via Xcode same as in step 3 but uncheck "Copy Items if Needed" as you already put the files there yourself.
My project then compiled and worked fine again.
In terms of a guess as to why the file went missing? Part of the upgrade process got me to delete the old frameworks and then run the scripts etc. from the plugin. I think what happened is later when I emptied my trash, that some references were lost. I also had the problem where I'd put Crashlytics into my .gitignore file so it disappeared out of ALL my projects every committed which wasn't great.
Hope this helps someone!
I have same error.
Please try pod update
and fix it.
If FirebaseCrashlytics 9.0.0 installed , problem will be fixed.
stalling FirebaseCoreDiagnostics 9.0.0 (was 8.9.0)
Installing FirebaseCoreExtension (9.0.0)
Installing FirebaseCoreInternal (9.0.0)
//hrer
Installing FirebaseCrashlytics 9.0.0 (was 8.9.0)
Installing FirebaseFirestore 9.0.0 (was 8.9.1)
Installing FirebaseInstallations 9.0.0 (was 8.9.0)

Fixing file 'project.pch' has been modified since the precompiled header was built error in Xcode

I was recently working on my application messing around in the info.plist section, and since that my application will not run on my test device:
file 'project.pch' has been modified since the precompiled header was built
Something to note is that the app runs fine in the simulator.
Edit: Now I am getting this error instead of the other one:
No such file or directory (/Users/Me/Library/Developer/Xcode/DerivedData/MyProject-abcdefghijklmnopqrstuvwxyz/Build/Products/Debug-iphoneos/MyApp./MyApp)
How to regenerate the info.plist file?
You could try a deep clean (not the same as Product > Clean) - Option+Command+Shift+K
Note: this means the clean the build folder (by pressing Option + Product -> clean folder)
Close your project or workspace.
In Finder: ⇧shift+⌘cmd+G
Paste: ~/Library/Developer/Xcode/DerivedData/
Delete the ModuleCache folder and empty trash.
Open up your project.
Clean: ⇧shift+⌘cmd+K
Build: ⌘cmd+B
In my case the error message had a small hint:
note: after modifying system headers, please delete the module cache
at
'~/Library/Developer/Xcode/DerivedData/ModuleCache/5CYAJ91AZCB7'
I tried and it worked.
Simply touching the project's pch file solved this issue it for me :
touch Test.pch
Product -> Clean
Product + Option -> Clean Build Folder
Close Project or Workspace
Clean 'ModuleCache' path in Finder.
Worked for me in Xcode6 GM and iOS 8.0.
When the .h file of a Library Provided with Xcode is changed (even a space), this error could occur.
The following maybe tried in order to fix this issue
In, Project -> Build Settings, change Precompile Prefix Header to NO
OR
Run rm -rf ~/Library/Developer/Xcode/DerivedData and Clean Build
I constantly had this since upgrading from Xcode 4.6 to Xcode 5 with iOS projects when using command line build (xcodebuild).
What worked for me is to use this as command line build command:
xcodebuild -project path/to/my.xcodeproj -configuration Debug clean build
Before this, I've tried:
Clean the project in Xcode GUI.
Delete the offending pch file.
Delete the offending pch file's parent folder.
Delete the DerivedData project folder.
None of the above worked for me under Xcode 5.0.2, Mavericks, iOS7.
Note that the problem didn't happen to me when using Xcode GUI.
I just go to directory "/$HOME/Library/Developer/Xcode/DerivedData/", delete everything there
Just Click Product from the menu and select Clean
Product>Clean
Worked fine for me.
I got the same problem. My error said like I need to delete the cache in the below locaition,
Users/myusername/Library/Developer/Xcode/DerivedData/ModuleCache/3FGETKFCU0N0W
3FGETKFCU0N0W was a folder, when I deleted it and then clean build the project. Then the error disappears.
rm -rf ~/Library/Developer/Xcode/DerivedData/
If you use AppCode you can try remove content form:
/Users/[Username]/Library/Caches/appCode30/DerivedData/
Worked for me :)
Also, just open terminal, and delete the .pcm file that has been generated (Xcode 6 onwards)
rm <path-to-pcm-file>
If you get this when switching between git branches, try adding this post-checkout hook which will clean your project every time you change branch.
!/bin/sh
xcodebuild clean -configuration Debug
Save as .git/hooks/post-checkout relative to your project root and don't forget chmod +x .git/hooks/post-checkout
For me, this problem is only occurring in Xcode 6 beta version, So I switch back to Xcode 5, and now problem is solved.
I tried all the steps suggested by all users here, but no one worked for me.
So, if you have both versions of Xcode and have issue only in Xcode 6 beta, then switch to Xcode 5 and clean the project, problem will be solved.
I tried these one by one but failed to build and run my project. So I changed Precompile Prefix Header to NO as mentioned by #Abhilash Gopal, then I reset the simulator,deleted the derived data, removed the corresponding .pcm file(In my case it was the UIImage.h from UIKit framework, so removed the UIKit.pcm).Then I cleaned the project and only then I was able to build it successfully. In earlier versions of Xcode these files were locked basically and were not allowed to edit. But its not the case now. Hope this helps someone who face the same situation.
The only solution there worked for me was running the following command:
sudo rm -R /var/folders/
But that gave me a lot of troubles in OS X.
I thought because /var/folders/ is for temporary files it should be okay to just empty anything in it.
But I was wrong see the following post: link
And the problem you described occurred every-time I tried to build my Xcode project - I'm building it from the CLI though Jenkins.
Which means I couldn't run the rm command every-time. So I found some inspirations and wrote the following ruby script which solved my problem:
#!/usr/bin/env ruby
require 'fileutils'
cache = Dir.glob("/var/folders/**/com.apple.DeveloperTools*")
FileUtils.rm_rf(cache)
I hope it would be helpful to someone.
Deleting project.xcworkspace did a trick for me.
project.xcworkspace is a directory which describes schema of current Xcode workspace state. Each time Xcode is launched it will regenerate project.xcworkspace if not exist already.
In order to delete project.xcworkspace:
Right click on your project file yourProject.xcodeproj
From drop-down menu choose Show Package Content
Purge xcworkspace file
If you are building on command line using xcodebuild remove '-parallelizeTargets' option passed to the command. That fixed the issue for me
After going through a lot of answers and helpful suggestions, I found out the solution to be: Uninstall Xcode 6 and reinstall it through the available dmg file and then install all the components for Xcode.
Product + Option -> Clean Build Folder, Clean Build Project, Deleting Module Cache files and Derived data files, using touch .pch, deleting pcm file, using command line to remove var/folders (Surprisingly, all of this did not help in my case)
Was stuck at it for more than 3 hours before finding the solution. Hope this helps someone.
Thanks.
Just open terminal and fire below command:
rm /Users/pratik/Library/Developer/Xcode/DerivedData/ModuleCache/LKL48GNAN6S7/UIKit-2X95M2Q1NPNPL.pcm
give your file path which return .pcm error. and then Clean Project and Run...Enjoy!!!

How to fix: Xcode cannot be opened because of a problem?

After installing Xcode 4.0.2, I get this error when I try to launch it by double-clicking on an existing project:
Dyld Error Message:
Library not loaded: #rpath/DevToolsFoundation.framework/Versions/A/DevToolsFoundation
Referenced from: /Developer/Developer/Applications/Xcode.app/Contents/MacOS/Xcode
Reason: image not found
Launching Xcode via the dock and opening the project from inside Xcode works fine. Also note that doing a repair install of Xcode did not resolve the issue. I haven't tried completely uninstalling Xcode and installing from scratch, but I would prefer to avoid that as I have my IDE nicely customized the way I like it.
Update: I just tried a complete uninstall of Xcode via sudo Developer/Library/uninstall-devtools --mode=all then rebooted and reinstalled. Still having the same issue.
Before you reinstall, make sure your project file is set to open with the expected copy of Xcode 4. Select it in Finder, press Cmd-I, and make sure the Open With... popup is set to the right copy of Xcode 4.
According to the discussion below, the problem is that it is not in the /Developer/Applications/ folder. However, I think that is just a clue to the source of the problem, because Xcode is supposed to work in multiple locations. It is possible that Xcode sets fixed paths when installed and can't be moved. Did you happen to move it after installing?
http://www.iphonedevsdk.com/forum/off-topic/35948-xcode-crash.html
It is the ALIAS that is busted, not Xcode. If you reinstalled Xcode, you should make a new alias for your Dock or Desktop or wherever. Delete the old alias as it is no good any more.
Xcode (should) install in /Developer . You can get to that by going to your hard drive named something like "Macintosh HD". Make a new alias from there.

Resources