iPhone app crashes from Finder - ios-simulator

I've written an iPhone app and only tested it with the simulator as I don't have an actual iPhone. If I Build and Go, I can see the app running. But if I go to Finder and then open it through the project's build folder, it just crashes immediately. Does anyone know the reason for this?

It crashes because double-clicking it causes Mac OS X to try and run it as a Mac app. It's got the same structure as a Mac app, and it's an x86 binary, so why not? But the iPhone app tries to dynamically link UIKit, fails to do so, and crashes. The simulator sets up the iPhone app's environment so that the linking succeeds. You could probably do this at the command line with careful use of environment variables, but the Finder doesn't do so.

Finder won't launch the simulator correctly. XCode is the only supported way to launch the simulator as far as I know.

So Tom, if I wanted to send that binary to a friend, what are the instructions for opening it?

Related

Can't make Siri Shortcuts work in macCatalyst app

I'm trying to port my iOS app to Mac using macCatalyst, and I'm having problem with Siri Shortcuts. The code complies and runs, but when I try to add shortcut using INUIAddVoiceShortcutViewController I'm seeing 'Shortcuts unavailable.'
Using
INVoiceShortcutCenter.shared.getAllVoiceShortcuts returns error [Intents] -[INVoiceShortcutCenter getAllVoiceShortcutsWithCompletion:]_block_invoke Error from -getVoiceShortcutsWithCompletion: Error Domain=NSCocoaErrorDomain Code=4099 "Couldn’t communicate with a helper application."
Any ideas what's I'm doing wrong? Same code works perfectly fine on iOS.
The Intents framework is unavailable at runtime on macOS except for WidgetKit support. The APIs are available at compile time in the Mac Catalyst environment to reduce the amount of changes required to compile for Mac Catalyst. Calling into the APIs as part of the shared code path between iOS and Mac Catalyst is fine, they will just return an error for Mac Catalyst, as you're seeing.
Posted 11 hours ago by edford 

watchOS2 and NSLog on device

I am using XCode 7 (beta) to write standalone watchOS2 App Extension.
Debugger works fine, so I can use breakpoints for example, but seems to be that NSLog() is not working for the Watch. Note: It works fine on simulator, but doesn't work on device
Whatever I write to NSLog(#"..") is not displayed in Debug Area.
So the question is:
Is this behavior expected or am I doing something wrong? Are there some workarounds to see some debug logs, may be use WatchConnectivity for example?
Thanks in advance!
Until NSLog() works on real watchOS 2 devices I've ended up using -[WCSession sendMessage:replyHandler:errorHandler:] to send log strings from my watchOS 2 app back to my iOS phone app and then NSLog them from my phone app.
Did you try this one?
It's a known issue on developer forum.
You have to unpair and re-pair your watch to trust your computer.
Then you could see NSLog in Debug area.

Why is iOS Simulator not running?

When I try to run my program, iOS Simulator goes black and displays this error:
Unable to boot the iOS Simulator.
When I click OK, Xcode shows this error:
Unable to run app in Simulator. An error was encountered while running (Domain = NSMachErrorDomain, Code = -300)
How I can I make it run again?
You probably are running two different instances of the iOS Simulator.
Clean the project. (CMD+SHIFT+K)
Quit Xcode.
Quit all instances of iOS Simulator.
Restart the computer.
Log in.
Make sure no instances of iOS Simulator are running (I had a wrong version set to Open At Login)
Run your project, and let Xcode open the right Simulator.
If you've recently updated XCODE and possibly have more than one installation you may need to specify which XCode is being used via the command line.
sudo xcode-select -s /Applications/Xcode6-Beta4.app/Contents/Developer/
Just Reset Content and Settings worked for me. Also clean the project once and build.

Xcode 4.2: Error 0xC002 when trying to use a jailbroken iPhone 3G for development

I have this jailbroken iPhone 3G with iOS version 4.2.1 (the latest supported version). When I connect it to Xcode 4.2, Xcode starts copying the debug symbols. It stops copying towards the end of the process, and shows the following error:
Xcode has encountered an unexpected error (0xC002)
No such file or directory, at ‘/SourceCache/DTDeviceKit/DTDeviceKit-867/DTDeviceKit/DTDeviceKit_Utilities.m:864’
Anybody experiencing anything similar?
I know I should try and restore the phone, but I'm asking just in case anybody can come up with a solution that doesn't involve restoring it.
In this post on mactechnews.de, one guy reports the same problem -- with no solution, so far.
Alright, after a lot of testing and digging up the filesystem... I solved it.
It turns out that there are just a few files that are not downloaded from the device (for reasons still unknown). They are related to the dyld cache (don't really know what this is and what it's for). Here are the steps to make your 4.2.1 device debuggable in XCode 4.2 and 4.3.x:
Close Xcode
Go to: ~/Library/Developer/Xcode/iOS DeviceSupport/4.2.1 (8C148)/Symbols/System/Library/Caches/com.apple.dyld/ Note: if you don't have this folder, run Xcode, connect your device, and wait until the error 0xC002 appears in Organizer - the folder should be created by that time.
Create 3 empty files there called:
.copied_dyld_shared_cache_armv6
.processed_dyld_shared_cache_armv6
dyld_shared_cache_armv6
Run Xcode and enjoy the light next to your device eventually go green:)
Or, for the terminal lovers:
cd ~/Library/Developer/Xcode/iOS\ DeviceSupport/4.2.1\ \(8C148\)/Symbols/System/Library/Caches/com.apple.dyld/
touch .copied_dyld_shared_cache_armv6
touch .processed_dyld_shared_cache_armv6
touch dyld_shared_cache_armv6
This is obviously a hack but it works perfectly for debugging and I haven't noticed any side-effects so far.
Enjoy!
Small update:
I tested it on my snow leopard hackintosh, with the Xcode 4.2 (most recent to date) and although the device is active in the organizer and it is possible to run the app on the device, i get black screen on launch. It gets installed but apparently debugger cannot get attached. I had the same problem with 4.0.2, when the 0xC002 problem didn't yet occur so I think it's unrelated and might even not happen to others. Nevertheless, 0xC002 is still solved.
On my main development machine with Lion and Xcode 4.3.2, device is perfectly debuggable.
The answer above (https://stackoverflow.com/a/9944892/1390251) works, basically,
but for newer versions of Xcode you probably need to rename the files as follows,
having them end with '7' instead of '6':
touch .copied_dyld_shared_cache_armv7
touch .processed_dyld_shared_cache_armv7
touch dyld_shared_cache_armv7
If not sure, you can keep both sets of files (...6 and ...7)
in the relevant folder (can also be 5.1.1 for that matter)
and it should work.
(have tested it on iPhone 4 with iOS v5.1.1 genuine)
It seems that you cannot debug apps on iOS 4.2.1. I tried several restores to iOS 4.2.1 with same effect. Downgrading to iOS 4.0 was the only thing that worked.
The reason for whole problem is that iOS 4.2.1 is not supported in XCode, according to this website.
Error in Xcode getting debugging info from 5.0.1 iphone
solved, see the link to archive with iOS5.0.1 debug info
download & unpack to "~/Library/Developer/xCode/iOS DeviceSupport/" & be happy =)
I fixed this bug in![enter image description here][1] this way:
I duplicate the 5.1.1(9B206), rename it to 5.1.1(9A405)[my ios device is this version], then the error is gone.

Iphone simulator hangs while installing apps

I am using snow leopard, xcode 3.22, i first had this issue when i was using os 4 beta, i have removed the xcode software from my system and reinstalled. I can't get any app to load in the simulator, the app starts to install in the simulator then nothing, I can install the app to my device, but i can run anything in the simulator it just hangs, i am not sure what to do
any idea?
I had the same problem and it drove me nuts. I finally figured it out.
Make sure that "/Library/Application Support/iPhone Simulator" is owned by your user id and that it is also writable by you. All the subfolders should also be owned and be writable by you.
Once I changed ownership of "/Library/Application Support/iPhone Simulator" to me everything worked.
I've had a similar problem. The simulator launches but stays on a blank screen. Then when I press "stop" in Xcode it doesn't stop. I have to force quit Xcode. I've tried many solutions including reinstalling Xcode.
Ultimately, the only thing that worked was changing the debugger from LLDB to GDB in the scheme. I don't know why this works.

Resources