MacOS - UIKit/UIKit.h not found - objective-c

Try to
#import <UIKit/UIKit.h>
And get error:
UIKit/UIKit.h file not found
What is it and how fix it ?))) Try to import Foundation - all ok )

Originally for macOS you could only use AppKit as an UI framwork, which is quite different from UIKit, so you couldn't reuse iOS code for macOS.
So you have to learn a much different framerwork with NSView base view instead of UIView and a lot of differences.
But then apple supported porting iOS apps to macOS. To do this you need to create an iOS app(if you don't have one) and turn on that option in the settings. Check out more at Running Your iOS Apps on macOS
You would still need to do a lot a work in making your app for macOS comfortable for users, but if you have no background in AppKit, probably it's still easier to go for UIKit

Related

IKImageView move tool not working in Mojave

My app Plumb-Bob is based on the IKImageViewDemo:
https://developer.apple.com/library/archive/samplecode/IKImageViewDemo/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004049
I compile it for MacOS 10.10+ and in my tests I noticed that the "move tool" is not working at all in Mojave (10.14) while it does as usual in the previous systems.
Since I have strongly modified IKImageViewDemo for my purposes, I have downloaded it again to make some test (see link above).
When build and run IKImageViewDemo I have verified that it has the same behavior:
On MacOS 10.14 the move tool shows its open hand cursor, but, when dragging, the image is not moved at all.
On older MacOS, it works like a charm.
I did not find any updates, deprecations and changes on IKImageView framework in 10.14, searching at Apple Developer's docs.
Can anyone address me to the solution, it is very important, in my app, to move around the zoomed image.
Thank you in advance

MessageUI for watchOS

I am have an app and in the iPhone app, we use MessageUI Framework, but when I try to add it to my Apple Watch Extension InterfaceController.h file like so:
#import <MessageUI/MessageUI.h>
I get this error:
'MessageUI/MessageUI.h' file not found
Does watchOS not support MessageUI ? and do I have readd the framework again?
WatchOS 2 does not support many of the standard frameworks found on iOS (including MessageUI). If you wish to do something more intensive that requires the need of frameworks available only on iOS, then you can use watch connectivity.
I asked this question a while ago, about a different framework, but the same idea applies: How to reference non-supported frameworks in Watch OS 2

Use UIImagePickerController in qt application

i am using qt 5.3 on mac to develop an iOS application. I want to use UIImagePickerController with objective-c to pick an image from ios gallery and show it in qt. I know how use objective-c code in qt. To use UIImagePickerController, i need to add <UIKit/UIKit.h> in objective-c file (.mm), but i get this error “UIKit/UIKit.h” file not found.
I’ve added this code in .pro : LIBS += framework UIKit.
Can someone tell me how can i use UIImagePickerController in qt?

'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UIKeyCommand'

My app is crashing when I try to display another view controller. It does work correctly when the iOS SDK is set to 7.0 and I am targeting iOS 7.0. But I need the app to target iOS 6.0. UIKit is (obviously) declared in the imports. The UITableViewController I am trying to present works perfectly fine as far as I'm aware - I created it for another app, using XCode 4.6.3, targeting 6.0 and it compiled without error (as does this one) but it also displays without crashing.
I could provide code, code which does nothing more than present the table view controller using a modal transition, but I even went to the point of connecting a UIButton to the UITableViewController - it worked on iOS 7, but not 6. It's my belief that when I compile with the iOS 6.1 SDK, it should be using iOS 6.1 frameworks?
UIKeyCommand is only available in iOS 7 and later, according to this. That gives me reason to believe that it is using the iOS 7.0 frameworks even though the iOS 6.1 SDK has been specified.
I've tagged this with the xcode tag as I believe it could possibly be caused by xcode incorrectly searching for the specified SDK's frameworks.
I had the same problem as you and here is what i did to solve it:
I opened the Storyboard as Source Code and searched for the tag : keyCommands , I found a tag similar to
<keyCommands> <keyCommand/> </keyCommands>
and i deleted it.
After that i runned the app in iOS 6 & 7 and it worked with no problem.
Let me know if this works on your app too!
Cheers!

How to stop supporting iOS7

I have just installed Xcode 5, and I have an application that should be targeted only to iOS 6.0 and iOS 6.1 devices.
How can I stop supporting iOS 7.0 ??
That is not possible, you can stop supporting previous versions of iOS, but not the other way. You need to prepare your app to work on iOS7.
YOu don't need to redesign your app or anything, just open in with XCode 5 and get rid of all the warnings/small bugs.
As others have noted, you can't "not support iOS 7". However, you can delay upgrading to the iOS 7 SDK (at least, in the short term).
To do such, simply continue using Xcode 4 to build your app. When you're ready to submit it, simply do such using Xcode 4 like you normally would.
For the time being, Apple will most likely accept apps built using the iOS 6 SKD. (Imagine, for example, that you've spent several months or a year building your app... Apple will still let you submit it for the time being even using an older SDK).
Further, the app will run and appear correctly (in many/most cases) using iOS 6 UI components for the most part (in example, UIAlertView is an exception to this, which will use the iOS 7's UIAlertView look).
In the long term, however, you really should convert your app to use the latest SDK.
It's not possible to prevent the installation of your app to devices that meet minimum version requirements.
Of course, you're free to check in your app the iOS version and do something about that. For example, if your concern is really that the user user should download another, iOS 7-designed version of your app, you can inform her about this possibility:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if ([self.window respondsToSelector:#selector(setTintColor:)]) // iOS 7
... // redirect user to better, tint-enabled version
return YES;
}