Can't Load Images on MAC Screensaver Release Build (It Works on Xcode Debug Build)

Can't load images on mac screensaver release build (it works on Xcode debug build)

NSImage(named:) loads from main application bundle, but your images in plug-in, so use something like the following (load from bundle containing your class)

imageView.image = Bundle(for: type(of: self)).image(forResource: "Image")

Tested with Xcode 11.2 / macOS 10.15. Images are in Assets of screensaver plug-in target.

SpriteKit in screensaver can't find images

I have looked into this project: https://github.com/leebradley/nyan-screensaver
And I found how to properly do it:

  1. You need to put images into bundle, not xcassets ( put it with .swift files )
  2. Instead of using image name use the following
let sourceBundle = Bundle(for: MainSwiftFile.self)
let imagePath = sourceBundle.path(forResource: "picture-name", ofType: "png")!
neededTextures = SKTexture(imageNamed: imagePath)

You need to provide the name of the .swift file with your principal class ( principle class in info.plist file ).
The rest is simple - forResource is a file name, ofType is a file extension and instead of passing usual name in imageNamed: you provide String of path to file.
"imagePath" is of a String type.

Mac OS X App fails to execute completion handler in release build but works in debug build

We can't read minds. Can't help you if you don't show us the real code.

BUT. It it possible that you've come across a compiler bug. I've had a similar problem, where the Swift compiler would generate incorrect code in optimized (Release) build — but the same thing would work fine in Debug. (rdar://18906781) I've also heard of other production apps written in Swift that simply do not work correctly in optimized builds (and so are shipped unoptimized).

Try reworking the code to achieve the same thing with different code — maybe you'll work around the bug.

If you have the time, I encourage you to try narrowing the bug as much as possible to make a test case and reporting it on http://bugreport.apple.com.

Cocoa ScreenSaverView

It's not clear to me if a SpriteKit view (SKView) can even be used in a normal OSX/iOS app. I have searched in the past and found nothing.

If SpriteKit is anything like other game frameworks (from which it borrows much of its structure) then it will use a traditional game loop; i.e. clear screen, draw everything, wait a bit and then repeat.

Cocoa apps use an runloop that reacts to events and take steps to only redraw what needs to be redrawn.

So I would say "No" to your first question.

As far as your second, code-related, question is concerned, then I cannot see much wrong with it, however I am not familiar with that init method; what class does it subclass?

iOS - Xcode Error: cannot attach to process due to System Integrity Protection

System Integrity Protection(SIP) aka rootless is a new security feature in OS X 10.11. By default it disables even the administrator to access/modify the root. Follow these steps to disable SIP:

  1. Restart your Mac.

  2. Before OS X starts up, hold down Command-R and keep it held down until you see an Apple icon and a progress bar. Release. This boots
    you into Recovery.

  3. From the Utilities menu, select Terminal.

  4. At the prompt type exactly the following and then press Return:

     csrutil disable
  5. Terminal should display a message that SIP was disabled.

  6. From the  menu, select Restart.

You can re-enable SIP by following the above steps, but using csrutil enable instead.



Related Topics



Leave a reply



Submit