I have an iOS app that gives support to Mac Catalyst (and runs in Mac OS). In the app, I have a feature where users can send text messages (basically select phone number, enter message content) via MFMessageComposeViewController.
And the code for which is:
if MFMessageComposeViewController.canSendText() {
let composeVC = MFMessageComposeViewController()
composeVC.messageComposeDelegate = self
composeVC.recipients = recipients
composeVC.body = body
self.present(composeVC, animated: true, completion: nil)
}
This piece of code works fine in iOS as well as in Mac OS (till mac os bigSur i.e, 11.6, and I tested this by myself). But in the latest Mac OS i.e., Mac OS Monterey (12.0+) this is not working. Basically the method MFMessageComposeViewController.canSendText() always returns false.
And if I run the code without checking this condition (just for testing purposes) I get the below exception:
[MFMessageComposeViewController] Unable to initialize due to + [MFMessageComposeViewController canSendText] returns NO.
An uncaught exception was raised
Application tried to present a nil modal view controller on target <MyApp.ViewControllerName:0x7fe3d6e67120>
Has anyone faced this issue or does anyone know if this is an OS bug or something's updated in the code in the latest OS?
Thanks!
Related
I'm attempting to target 10.7 with my Mac OS X app, but when I try running it on a 10.7 machine no window opens and I get "Could not connect the action buttonPressed: to target of class NSApplication" logged to the console.
When I try to build the app locally to debug, I get "-fobc-arc is not supported on platforms using the legacy runtime". It looks like I need Xcode 5+ which isn't supported on 10.7 so I'm at a loss for how to continue debugging this issue.
I found an answer from another question. 10.7 doesn't support storyboards.
https://stackoverflow.com/a/30954258/873546
I upgraded my mac OS to mavericks and also my Xcode 4.6 to Xcode 5.1.1.
I tried to launch my iOS app which was originally built on iOS 6 in the iOS 7.1 simulator.
I get the login page as intended but as soon as the login page is displayed I get an error in the main method exactly at the below line and the execution stops there. The description says "signal SIGKILL". I am not able to figure out a fix for this as all the app delegates call back methods are called fine and there seems to be no issues with the application code. Can anyone please let me know what could be the problem here.
return UIApplicationMain(argc, argv, nil, NSStringFromClass([CommVotesAppDelegate class]));
Application crashes if I switch on "Use Auto Layout" feature for my xib file.
The error on console is:
"Assertion failure in -[NSAutoresizingMaskLayoutConstraint _setSymbolicConstant:constant:], /SourceCache/AppKit/AppKit-1138.51/Layout.subproj/NSLayoutConstraint.m:596".
If I disable this feature the application runs smoothly. I tried [View setTranslatesAutoresizingMaskIntoConstraints:NO] also but same result.
Runs fine on Mountain Lion and on some Lion machines.
OS: Mac OS X Lion 10.7.5(11G56). Could anybody help me to resolve this error.
Thanks in advance.
I'm currently working on a port of my Windows game for Mac OS X, it runs fine on my Mac when compiled with Xcode 4.5.2 on OS X 10.8, but it crashes on a friends Mac running 10.6. At first I thought it was due to one of the Frameworks I've been using, but the standard Cocoa app template crashes at well, without any visible error message.
I already tried setting the Deployment Target to 10.5, but this doesn't change anything. When starting the App, it appears for a short time in the Dock and then disappears without showing any kind of UI or error message.
I need my sandboxed app to reopen an opened file after the app is restarted. Apple provides security-scoped bookmarks with the NSURLBookmarkCreationWithSecurityScope and NSURLBookmarkResolutionWithSecurityScope options in the NSURL bookmark creation and resolving methods. However, these flags/options are only good for 10.7.3 or later and cause an app prior to 10.7.3 to fail.
How do I handle retention/reopening of the file bookmark for 10.6 to 10.7.3 in a sandboxed app?
--
FOLLOW-UP: Please see my answer below. The issue was not caused by using NSURLBookmarkCreationWithSecurityScope but by using the security-scoped bookmark start and stop methods.
It turns out using NSURLBookmarkCreationWithSecurityScope does not cause an issue with 10.7 - 10.7.2. What causes the failure is calling -[NSURL startAccessingSecurityScopedResource]: which is not supported prior to 10.7.3. Therefore, you need to wrap calls to this method (and the corresponding stop method) with an OS check or a respondsToSelector check. I tested that the bookmark still works in 10.7.1 as long as you make sure not to call start/stop.
Here are some code snippet for using respondsToSelector that will help any others that run in to this problem:
Use this to start usage:
if([bookmarkFileURL respondsToSelector:#selector(startAccessingSecurityScopedResource)]) { // only supported by 10.7.3 or later
[bookmarkFileURL startAccessingSecurityScopedResource]; // start using bookmarked resource
}
And this to stop usage:
if([bookmarkFileURL respondsToSelector:#selector(stopAccessingSecurityScopedResource)]) { // only supported by 10.7.3 or later
[bookmarkFileURL stopAccessingSecurityScopedResource]; // stop using bookmarked resource
}