BSMachError on granting access to camera - ios

This is a mystery to me and I hope you can help me out...
I have made an app that has got a QR-scanner and when accessing it on a fresh install on my iphone an alert is shown subsequently. The problem is that the camera image freezes up and I am unable to scan any QR-codes...
This problem goes away once I run the application from xcode again...
This is what's printed out in the console:
_BSMachError: port 13403; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
Note that I have added NSCameraUsageDescription to Info.plist.
Thanks for your help!
UPDATE:
I've tried adding NSPhotoLibraryUsageDescription and other similar permissions to the Info.plist file, as well as changing the localization native development region from EN to US (as solution read in other threads) but still no luck...
UPDATE #2:
I created a new project yesterday, reusing the same code and the "QR-scanner view" works just fine!
Question: Could it be some form of conversion-related issue?
The project was created in Swift 2.2 and converted to the new syntax of Swift 3 just recently. That is the only real difference regarding the issue that I can think of...
Happy to hear your thoughts on this matter!

It might be occurring due to missing permissions.
Try adding the below in Info.plist keys like
NSPhotoLibraryUsageDescription

Found the problem!
The issue suddenly occurred in my new project as well, so I started debugging!
While running the app I checked out the Debug View Hierarchy (the 3D snapshot function in the console menu)...
So it turned out that there was a second instance of the UI running on top of another one - This is the reason why my camera-view appeared to have frozen.
Cause: I have a slide-out menu (from tutorial: http://dennissuratna.com/slide-out-navigation-swift/) set in my app and had added login and registration-views
(from tutorial: https://www.youtube.com/watch?v=PKOswUE731c) to the project.
Now I found out that the second instance of the UI was created after logging into the app and thereby causing the problem.
Removing the connections to the login and reg-views solved the issue, so now I just have to find out where to make the proper implementations for it all to work as desired.
NOTE:
The BSMachError-message is still printed out in the console whenever I run a fresh install of the app on my iPhone. The "error" is printed in the console when the alert for granting access to the camera is shown on screen.
The app runs as expected, without any problems, so I think it's safe to say that the
BSMachError-printout should be viewed as a printout and not an actual error that would cause a potential crash.

Xcode 8.2.1, iOS 10.2.1
Just ran into the same issue. Please make sure you have a message entered for NSCameraUsageDescription and NSPhotoLibraryUsageDescription.
To easily find these keys select "Show Raw Keys & Values" from the Editor menu.
Hope this helps.
Cheers.

Related

The file “MyApp” couldn’t be opened because you don’t have permission to view it error (Xcode 11)

I am currently developing an app using Xcode 11 and I am confused by the root of error message I am receiving when I try to build my app to run in the simulator. I have tried for hours to resolve this, using different tutorials I found on Stack Overflow but really haven't had any luck due to the fact most of the time these issues were reported for Xcode 11. The last time I had the software open, it ran totally fine so I'm very confused what changed since I last saved the project. If you can please help give some, that would be greatly appreciated. I have also attached an image of the error.
What I Have Already Tried
Cleaned the build folder
Manually cleaned the Derived Data folder
Raised the permissions of the executable within Finder
Check to make sure that the compiler is set to default in build options
Checked the info.plist and updated the executable file to ${EXECUTABLE_NAME}
Changed my derived data folder to another location
Deleted manually added folders
Restarted Xcode
Restarted my computer
Image of error as it appears on Xcode:
It appears that it's an iOS app, correct? With everything else you mentioned trying, there might be an issue with the simulator, so you could try running in a different simulator or resetting the current one to default settings. I've attached a screenshot and you can find this under the "Hardware" menu in the simulator. Note that it will delete all installed apps in the simulator.
I realized my issue was with a swift file that I made that was corrupted. The file was linked to a view controller and the view controller works fine but the class file was fully corrupted and would even make Xcode crash if I tried to open the file.
Tips for people who have the same issue:
Read through all the errors and find the specific file thats causing the issue. Usually the issue stems from dependency files but if you're lucky like me then its a simple fix

Why Xcode shows "This app could not be installed at this time." pop-up?

When I run the project and add the app in simulator for the first time, everything is okay. But when I run it again, Xcode prompts this message as a pop-up window at the end of compilation:
This app could not be installed at this time.
I already checked the relevant question, and tried all the advised ways to solve this issue; checking mentioned logs, cleaning project, restarting simulator, changing it, erasing all content and settings in it. Nothing works. I must erase the app and recompile it every time to open the app. Did you get the same message before? Is there any way to detect problem and resolve it? Btw, I use Xcode 9.2 at High Sierra.
This error pop-up may come up for different reasons. There is no specific reason to see it for now. In my case, a JSON file that I added to Bundle in order to provide mock data triggered this issue. This file was containing a Turkish letter in one of the keys. After I fix it, the pop-up is gone. Interestingly, earlier simulators (<=9.1) work properly if JSON file contains Turkish letter but 9.2 simulators cannot tolerate it.
Worked for me when I rebuild the project after deleting the derived data folder.
I think I may have found a solution. This all started a short time after I let Xcode update my project settings. Specifically on my CocoaPod-Subproject. I removed the pods and reinstalled them and now I am no longer getting the pop-up.

unable to verify mobile app on IOS9 using Xcode 7

I have been trying to take advantage of Xcode now allowing developers to test on devices without being enrolled on the developer program.
This was working just a few weeks ago, no problems at all
however, for no apparent reason, I am getting this error message whenever i try to run my app on the iPhone:
after some googling a website led me to this page in the settings app:
From what i can gather on google, The problem is that the app isn't verified. However when i click verify nothing changes. The text at the top of the screen changes very briefly (i assume it's saying loading)
I have tried deleting the provisioning profile, that Xcode had created, and clicking fix when Xcode tells me it can't find the profile. Nothing changed
so my question is: does anybody know what the problem is here and how to fix it?
I've never seen a problem with that before but with x-code there are usually 3 really annoying but normally foolproof steps to solving a problem such as this.
1) Update your IOS and make sure you are on the most recent version
2) Reinstall X-code
3) Recreate the app
Like I said those 3 steps can normally solve any non code related problem.
Hope that helps!

App installation failed: Could not write to the device

In Xcode 6.3, I got this error when trying to run an iOS project written in Swift on a real device.
App installation failed
could not write to the device.
I tried to clean the project and run again, but the same error occurs.
How can I fix this error?
Deleting the app on the device and running the project again works for me.
I did a Clean and installed my app successfully.
Product->Clean(Shift-Cmd-K)
I turned off the device and turned it on again after which I did not get such error.
OK, few things you should consider that could guide us to the problem, please check and post the answers:
is your project using capabilities? are they set correctly (should be all green)
did you try with a different project (something really simple)?
are you able to install apps from the App Store?
did you check the amount of free space left in the device?
if not, another suggestion will be using exception breakpoint, there is someone that posted an explanation how to setup it, do it and post the logs
App installation failed
I hope it helps you
Got this problem twice in one week on complete different devices.
One device had no more storage left, after deleting some apps the project installed perfectly.
The other device was fixed after rebooting the device
If you are using a free developer account you may need to uninstall some other apps you have signed.
For me it was the provisioning profile - I used distribution instead of development
My issue was an embedded framework.
Go to "Build Phases" -> "Embed Frameworks" -> Check "Copy only when installing", and it got rid of the issue for me.
For me the following did not work on iOS 11 beta 10, XCode 9 beta 6:
Restart the device
Deleting the app from the device
No symlinks were in the project
There was plenty of storage available
Deleted Derived Data and voilá, it worked again
in my project this problem happened because there was a folder with symbolic link. I removed that folder and it worked properly.
This error has many potential root causes, as can be seen by the large variety of suggested answers. The best approach to troubleshooting app installation issues like this one is usually to inspect the console of the iOS device itself, as that'll often provide much more specific error messages. In Xcode open the 'Devices and Simulators' window and take a peek at the logs of the device where your app is being installed.
In my case, the "Could not write to the device" error was being caused by this:
Feb 27 10:54:58 iPhone-7-110 installd(MobileSystemServices)[46] : 0x16f92f000 -[MIBundle _validateWithError:]: 38: Failed to load Info.plist from bundle at path /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.ebmR6U/extracted/SampleApp.app/Frameworks/SomeFramework.framework
Which clearly hints at what's actually going on. I had forgotten to set an Info.plist file for my dynamic framework target (used by the app).
I had a symlink in my project to a file outside of the project. When I deleted this symlink the install worked fine.
I was having the same error, i just deleted the project and fixed!
Go to Window -> Project and right click, and remove from projects!
In the case of your device have an app with the same bundle identifier, Xcode will throw this error.
Try to delete potential app with the same bundle identifier.
Check your provision profile, maybe you are using the app store provision profile like me. I had to change the app store provision profile to development, now it's working.
Tried all of the above answers: Deleting the app, clearing storage space, cleaning the project...
What finally worked was bumping the build number in info.plist (General > Build)
For anyone still facing this Issue:
There are so many reasons and this is one of them as it happened to me.
I've faced the same problem and I was connected wirelessly and If you are trying to install the application in wireless connecting mode (connected through same network), this might probably because of poor internet connection. Check your internet connection and try again, it works fine...
Get rid of embedded libraries, dont' just throw it in there make sure it is embedded indeed.
If you use your iPhone for debug, maybe, because your iPhone's storage space is less than your debug App.
Clean your iPhone --- Real machine
Clean your Mac --- Simulator
This looks like another time waster courtesy of Apple's amazingly high class development team. On iOS11 Xcode9 (pick your beta, any one works) this will happen randomly. Appears to be more frequent if you dare to switch apps while compiling. Just build again and stare at xcode - it'll work the second time without fail in my experience.
Apparently this message can also appear if the system clock of device where the app is being installed is too far away from the current time.
I was doing some tests with date formatters by changing my iPhone's system clock and eventually forgot to reset it to the current time. Afterwards it always displayed the same message ("could not write to the device.") whenever I attempted to run the app. Simply resetting the clock in Settings fixed the issue.
Nothing helped me. I followed the below steps,
Clean derived data folder
Quit Xcode and disconnect device
Restart Macbook
Restart Device
Open Xcode
Clean and run the project
Finally I got it working!!
I am facing same issue then solved out follow this step and now its working.
Deleting the app from the device
Try to install another application
Remove derived data in X-code.
Restart X-Code then clean and build the project then run.
It's still not working then
Remove un-used application
Restart the device and check the Available and capacity in settings
Again app run in device
I hope its worked, enjoy it.
My problem was I had initially installed the app using a different set of developer credentials on the device. Deleting the app from the device fixed it.
Maybe it can be due to the following error App installation failed. No code signature found. In my case after a project clean the description of the error switched to "No code signature found".
In my case I created two frameworks but they had the same bundle identifier.
This caused the installation to fail, so double check the frameworks bundle identifiers and make sure that each of them have a unique bundle identifier.
Environment: Xcode 10
sometime this error occurs due to wrong certificate.Please make sure your certificate.
Also this the error shown if your machine running Xcode is low on space.
Once I had to load an App Container for debugging purposes into an iPad, said operation failed because the container was too big (18 GB) for this device (16 GB minus the OS), so that I desisted the task and completly forgot about it, leaving the failed installation in the device. Later, when trying to install a different application this error appeared, once I got rid of the failed app installation, everything got back to normal.
Basically, your Ipad might be low in storage.
One reason this can happen is if your app bundle contains broken symlinks.

Unable to sign in to Google from the GooglePlusSample code using GooglePlusPlatform

I am running the GooglePlusPlatform Sample Code provided by Google to learn about its SDk. However, when I run the application and click on the sign-in button it generates an error as:
Error Domain=com.google.GooglePlusPlatform Code=-1 "keychain error"
UserInfo=0x1100bdd0 {NSLocalizedDescription=keychain error}
Same error also occurs in another application I have created which uses the GooglePlus Sign in. I Googled about it, but could not find anything useful. Please help!
Go to TARGETS > Capabilities > and enable "KeyChain Sharing".
I actually filed this bug on the Google Services GitHub repo, and got responses from the coders sayings that it´s an Apple Bug and there´s nothing they can do about it.
https://github.com/googlesamples/google-services/issues/82
Good news is, that the problem only happens when Xcode is attached to the phone. It works fine otherwise. So even though it's a pain to test, we shouldn't worry about it being a problem for end users. (fingers crossed)
I see this is not happening in simulator. And on real devices, this happens only when exception break point is created. Just remove that break point and try. It should work.

Resources