How do I initialize IKImageView? - cocoa

I am completely stumped with this one: I'm new to Xcode, coming from Windows. I create a brand new Cocoa app, place an IKImageView in Interface Builder, save and launch the app. Xcode shows the app icon bouncing forever, never launching. If I trace into it I get application crash right away.
I've downloaded examples from Apple but I cannot see how they initialize IKImageView, if that's what I'm failing to do. I've been searching for a solution for hours. Help?

The problem is that you are not including the required frameworks that are used by IKImageView. Just follow the instructions that are found in the Image Kit Programming Guide, in particular the section labeled Using the Image Kit in Xcode and you should have no problems.

Related

I have a major problem with Xcode not loading anything

I was trying to build an app using a map view kit. It was all fine and I used advice to add the wk map kit framework to the build phase library.
Now nothing loads, can’t add any UI elements as the whole thing just stalls. I’ve uninstalled Xcode and still have same problem. Any ideas?
I’m just trying to create a new app and add things like image view / map kit / buttons. Nothing works it just sits there loading with the spinning wheel of death.

SwiftUI Preview Canvas Build Fails but Project Build does Not

I am working on a project to add SwiftUI to a legacy app that uses Cocoapods. When I try to run the preview canvas the build fails and the canvas cannot run.
The cause is an issue building one of the included pods in the project (we’ll call this pod ‘LibraryX’). When XCode tries to build LibraryX it encounters a segmentation fault. But when I build the project itself there is no problem building LibraryX and starting the app.
I have tried looking for SwiftUI-preview-specific build settings in the XCode project build settings and have not been able to find anything. I have double checked the build path settings (as in this answer) and also verified that I am building on the correct device (as in this answer). In general, Googling for others who are facing similar issues has not turned up anything like my issue so far.
What I am wondering then is this: Does XCode use different build settings for building the project for use in creating the preview canvas? If so is there some way to configure how the preview canvas build works?
Because LibraryX is proprietary and the SwiftUI view I’m trying to add is simply the default “hello world” view that XCode creates there is not much I can share in the way of code samples for this question.
SwiftUI has still some bugs and is not perfect yet.
The canvas is part of SwiftUI and "shares" some of these bugs.
Sometimes you find yourself in a situation, where (a.) something does not work on Canvas or (b.) does not work correct on the simulator but (c.) works on a real device perfectly.
Most likely everything will get better over time, because SwiftUI is quite new (less then a year old) and Apple is pushing it.
My "solution" for the moment in similar situations is to not rely on canvas and just test on simulator.

Macos app displays view in Xcode, but is totally blank when launched outside of Xcode

I'm working on a small macos app, which I'm building with storyboards/interface builder in Xcode 10.2.1 on MacOS 10.14.5 (though I've set a deployment target of 10.13, if that matters).
When I run the app within Xcode, i.e., by hitting the "play" button, it loads up just fine and is visible and operates.
However, when I "archive" it to a freestanding executable and then try to run the app from the hard drive, it opens up on a blank screen. (See screenshots below.)
I've cleaned the build folder. I've also made sure to clear any/all build warnings and autolayout constraint warnings.
Here it is, running perfectly fine within xcode:
And here it is, displaying nada when run on its own:
The app uses no third-party libraries, no bundle assets, and only has one ViewController---nothing fancy at all happening here. The only weird UI thing that I'm doing is that there's a very small webview in the bottom-right corner that I'm using as a hack to load js-based web content (the mysterious white dot in the working screenshot).
Ok, I figured this one out myself, so for the purposes of google/if someone else has this problem: there seems to be a bug in WKWebView of some kind, adding it to IB kills everything else in the view. (Or maybe this is intended, and WKWebView requires it's own independent view? Dunno.)
The solution is to create it programmatically and never put it in the view at all. You can still load web content in the background, scrape information from pages, etc. without it ever being part of a view.
Not only WKWebView, also AVPlayerView should not placed int IB, too.
it cause same result.

How to run Objective C program in terminal of my macbook pro?

I am totally new to xcode and macbook , i have developed a small ios application for ipad air running which in emulator is showing me white blank screen so thought of running it in terminal to debug the program , can anyone help me with this
Thank you
If your project builds and runs and shows a white screen in the simulator, there is likely a logic error in your code. If you want to make a console application you would have to create an osx command line project. Google debugging in xcode. Try a beginners tutorial that you can follow along and make something appear on your screen. Sprite kit games are easy to make and give quick results and satisfaction. Take a look at this tutorial for basic sprite kit game.
Sounds like you forget to set rootview controller . Go to your storyboard and check Initailview controller is enable or disable

XIB doesn't open when app launches in mac application

I am a newbie in Mac development as I am trying for the first time to port my iPhone app on mac.
This might look a silly question to all experienced developers but please be fair with me as I don't know much about Mac programming.
I started a new project on mac and it was all good.The application was opening and I could see the window opened.
As I wanted to implement a movie player I followed Simple Movie Player Tutorial by Apple and after that tried to open the app.Now when app launches I can't see window of the application.I need to open a video from File menu which makes the application window to appear.I want the window to appear right at the app launch!
Please help as all my search got in vain and I strongly feel that this is the right place to get the right direction.
Thanks!
That appears to be the way that particular app works. It requires a movie file. There's no such thing as a new, untitled document for that app. From the bottom of the page you linked to: "When the player launches, you can open and play any QuickTime movie of your choice. Simply locate a .mov file and launch the movie from the File > Open menu in your media player application."
It appears that the recorder application that you will build in later steps of the tutorial opens a window at launch.
One other thing to be aware of: as of Lion, due to the application resume feature, launching an app will not always open a new, untitled document. Lion will try to restore the application to the state it was in when you quit it. Since this tutorial was written before that feature existed, it doesn't have explicit support for it.

Resources