Date   

Re: WindowController

Gerriet M. Denkmann
 

On 18 Jul 2017, at 04:18, Quincey Morris <quinceymorris@...> wrote:

On Jul 17, 2017, at 14:08 , Gerriet M. Denkmann <g@...> wrote:

It never has. Even after the first time where showWindow will succeed.
This is — in some sense — impossible. There is a window. (You can see it.) Either the debugger is lying to you, or the window is unrelated to the window controller. Whichever it is, it’s worth investigating further.
if ( self.prefController == nil )
{
self.prefController = [ [ NSWindowController alloc ] initWithWindowNibName: @"PrefWindow" ];
NSLog(@"%s prefController %@",__FUNCTION__, self.prefController);
};

[ self.prefController showWindow: self ];
NSLog(@“%s window %@“,__FUNCTION__, self.prefController.window);

prints prefController once
window = nil always


BTW, in your XIB file for the preferences window, did you leave “Visible at launch” checked? It shouldn’t be, if you’re using a window controller, but OTOH I can’t see it having this result if you did.
Without “Visible At Launch” I never see a window - not even the first time.

Kind regards,

Gerriet.


Re: Localised Windows

Steve Christensen
 

Did you check to see that the German localization of your strings is included in both targets? If you open both of the app bundles do you see de.lproj folder > PrefVWindow.strings in both?

On Jul 17, 2017, at 11:54 AM, Gerriet M. Denkmann <g@...> wrote:

I have two apps: one in Objective-C, the other one in Swift.

Both have:

PrefWindow.xib
PrefWindow.xib (Base)
PrefWindow.strings (German)


The problem is:

1. The Objective-C version just ignores PrefWindow.strings.
2. The Swift version prints (whenever it should show the window):

… [strings] ERROR: QvC-M9-y7g.title not found in table PrefWindow of bundle CFBundle 0x100d02860 </System/Library/Frameworks/AppKit.framework> (not loaded)


But PrefWindow.strings (German) has:
/* Class = "NSWindow"; title = "Preferences"; ObjectID = "QvC-M9-y7g"; */
“QvC-M9-y7g.title" = "Einstellungen";

What am I doing wrong?

Gerriet.


Re: WindowController

Jon Gotow
 

Is the 'window' outlet of the XIB file's owner set to point to the window in the XIB? It doesn't sound like it.

- Jon

On Jul 17, 2017, at 3:44 PM, Gerriet M. Denkmann <g@...> wrote:


On 18 Jul 2017, at 04:18, Quincey Morris <quinceymorris@...> wrote:

On Jul 17, 2017, at 14:08 , Gerriet M. Denkmann <g@...> wrote:

It never has. Even after the first time where showWindow will succeed.
This is — in some sense — impossible. There is a window. (You can see it.) Either the debugger is lying to you, or the window is unrelated to the window controller. Whichever it is, it’s worth investigating further.
if ( self.prefController == nil )
{
self.prefController = [ [ NSWindowController alloc ] initWithWindowNibName: @"PrefWindow" ];
NSLog(@"%s prefController %@",__FUNCTION__, self.prefController);
};

[ self.prefController showWindow: self ];
NSLog(@“%s window %@“,__FUNCTION__, self.prefController.window);

prints prefController once
window = nil always


BTW, in your XIB file for the preferences window, did you leave “Visible at launch” checked? It shouldn’t be, if you’re using a window controller, but OTOH I can’t see it having this result if you did.
Without “Visible At Launch” I never see a window - not even the first time.

Kind regards,

Gerriet.





Re: Localised Windows

Gerriet M. Denkmann
 

On 18 Jul 2017, at 04:49, Steve Christensen <punster@...> wrote:

Did you check to see that the German localization of your strings is included in both targets? If you open both of the app bundles do you see de.lproj folder > PrefVWindow.strings in both?
Both have: app → Content → Resources → de.lproj → PrefWindow.strings



On Jul 17, 2017, at 11:54 AM, Gerriet M. Denkmann <g@...> wrote:

I have two apps: one in Objective-C, the other one in Swift.

Both have:

PrefWindow.xib
PrefWindow.xib (Base)
PrefWindow.strings (German)


The problem is:

1. The Objective-C version just ignores PrefWindow.strings.
2. The Swift version prints (whenever it should show the window):

… [strings] ERROR: QvC-M9-y7g.title not found in table PrefWindow of bundle CFBundle 0x100d02860 </System/Library/Frameworks/AppKit.framework> (not loaded)


But PrefWindow.strings (German) has:
/* Class = "NSWindow"; title = "Preferences"; ObjectID = "QvC-M9-y7g"; */
“QvC-M9-y7g.title" = "Einstellungen";

What am I doing wrong?

Gerriet.


Re: iOS - Debugging an uncooperative UIAlertController

Alex Zavatone
 

Getting a little closer on this one.  

Apparently the UILabels within the UIActionViews have the appropriate text, but the UILabel and the UILabel’s tint colors are 0 or close to it and the font isn’t accessible.  Is there some known case where a UILabel’s view is not completed being created for a UIAlertAction?

This is working fine in the simulator and failing on the device 100% of the time.  

WELL!

It turns out that our UIAlertController category was grabbing the tint value from [UIApplicationController sharedApplication].delegate.window.tintColor;

This would return a close to zero tintColor only on some devices. Why?  Who knows.  Simply commenting out that line let the expected tintColor be displayed.  

Why the View Debugger showed a no font assigned to the label seemed odd, but as soon as I commented out that line, this worked. I’ll check to make sure that the tintColor isn’t close to white or transparent.

Apparently, assumption is the mother of all something something.

Cheers,
Alex Zavatone

On Jul 17, 2017, at 12:03 PM, Alex Zavatone <zav@...> wrote:

On certain iDevices, we have a UIAlertController that refuses to display the text of the only button, the OK button.  This has been a problem for the past year and of course it only appears in the alert used for the user to complete registration.

Oddly enough, in the UIAlertAction the text is not nil, the button area is tappable, we are adding it to the alertController in thread 1 and on some devices, it just doesn’t appear.

Does anyone have any tips for debugging this type of situation?  I have a reproducible case on one device now (iOS 9.3.5, iPad 2) and am about to start looking in to the view hierarchy to see what I can see.

Has anyone else seen this type of situation before?

Thanks in advance,
Alex Zavatone




Re: WindowController

Gerriet M. Denkmann
 

On 18 Jul 2017, at 04:55, Jon Gotow <gotow@...> wrote:

Is the 'window' outlet of the XIB file's owner set to point to the window in the XIB? It doesn’t sound like it.
Indeed it was not. After connecting it as it should have been, now all works perfectly as expected.
Thanks a lot for this brilliant idea!

This brings up another question:
I seem to remember that once Xcode allowed me to create a window + window-controller together (with all connections nicely set).
Today I could not found this (Xcode 8.3.3).
Can this be done; if yes: then how?




On Jul 17, 2017, at 3:44 PM, Gerriet M. Denkmann <g@...> wrote:


On 18 Jul 2017, at 04:18, Quincey Morris <quinceymorris@...> wrote:

On Jul 17, 2017, at 14:08 , Gerriet M. Denkmann <g@...> wrote:

It never has. Even after the first time where showWindow will succeed.
This is — in some sense — impossible. There is a window. (You can see it.) Either the debugger is lying to you, or the window is unrelated to the window controller. Whichever it is, it’s worth investigating further.
if ( self.prefController == nil )
{
self.prefController = [ [ NSWindowController alloc ] initWithWindowNibName: @"PrefWindow" ];
NSLog(@"%s prefController %@",__FUNCTION__, self.prefController);
};

[ self.prefController showWindow: self ];
NSLog(@“%s window %@“,__FUNCTION__, self.prefController.window);

prints prefController once
window = nil always


BTW, in your XIB file for the preferences window, did you leave “Visible at launch” checked? It shouldn’t be, if you’re using a window controller, but OTOH I can’t see it having this result if you did.
Without “Visible At Launch” I never see a window - not even the first time.

Kind regards,

Gerriet.







Re: WindowController

Jon Gotow
 

On Jul 17, 2017, at 4:06 PM, Gerriet M. Denkmann <g@...> wrote:

Indeed it was not. After connecting it as it should have been, now all works perfectly as expected.
Thanks a lot for this brilliant idea!
Glad that fixed it!

This brings up another question:
I seem to remember that once Xcode allowed me to create a window + window-controller together (with all connections nicely set).
Today I could not found this (Xcode 8.3.3).
Can this be done; if yes: then how?
When you create a new source file for a class that's derived from NSWindowController, Xcode will offer to make the class files as well as a XIB file (all wired up) for you. Unfortunately, there's no way to get it to do this after you've created the class - it's a 'creating-a-new-class' workflow and that's it.

- Jon


Re: Localised Windows

Gerriet M. Denkmann
 

On 18 Jul 2017, at 04:57, Gerriet M. Denkmann <g@...> wrote:


On 18 Jul 2017, at 04:49, Steve Christensen <punster@...> wrote:

Did you check to see that the German localization of your strings is included in both targets? If you open both of the app bundles do you see de.lproj folder > PrefVWindow.strings in both?
Both have: app → Content → Resources → de.lproj → PrefWindow.strings
The Objective-C version localises my PrefWindow if I *not* use a WindowController, but instead:

if ( self.window == nil )
{
NSArray *temp;
[ NSBundle.mainBundle loadNibNamed: @"PrefWindow" owner: self topLevelObjects: &temp ];
};

[ self.window makeKeyAndOrderFront: self ];

Either this is a (rather silly) feature of NSWIndowController, or I do not know how to use it properly.
Anyway it works.
Now to fix the Swift version.




On Jul 17, 2017, at 11:54 AM, Gerriet M. Denkmann <g@...> wrote:

I have two apps: one in Objective-C, the other one in Swift.

Both have:

PrefWindow.xib
PrefWindow.xib (Base)
PrefWindow.strings (German)


The problem is:

1. The Objective-C version just ignores PrefWindow.strings.
2. The Swift version prints (whenever it should show the window):

… [strings] ERROR: QvC-M9-y7g.title not found in table PrefWindow of bundle CFBundle 0x100d02860 </System/Library/Frameworks/AppKit.framework> (not loaded)


But PrefWindow.strings (German) has:
/* Class = "NSWindow"; title = "Preferences"; ObjectID = "QvC-M9-y7g"; */
“QvC-M9-y7g.title" = "Einstellungen";

What am I doing wrong?

Gerriet.


Re: WindowController

Marco S Hyman
 

On Mon, Jul 17, 2017 at 11:27 am, Gerriet M. Denkmann wrote:



How did you hide the window (orderOut: or close)?
Clicking the red button.
Which probably does a close which is not what you want. Assuming that your window controller is your window delegate (I think that is set up automagically) you want to add a method to your controller. Something like this:

// window delegate function... orderOut instead of close

func windowShouldClose(sender: AnyObject!) -> Bool {
if let window = window {
window.orderOut(sender)
}
return false
}


Drawer window error

Graham Cox
 

On Sierra, I’m getting the following posted when I open a window that hosts a drawer:

2017-07-18 10:06:31.546972+1000 Ortelius 2[10080:3577648] [General] ERROR: Setting <NSOutlineView: 0x10182d140> as the first responder for window <NSDrawerWindow: 0x10183ed30>, but it is in a different window (<NSWindow: 0x6180001e5400>)! This would eventually crash when the view is freed. The first responder will be set to nil.
(
0 AppKit 0x00007fff9f5969cf -[NSWindow _validateFirstResponder:] + 557
1 AppKit 0x00007fff9ed1174c -[NSWindow _setFirstResponder:] + 31
2 AppKit 0x00007fff9edb9cd2 -[NSWindow(NSDrawerSupportPrivate) _changeAllDrawersFirstResponder] + 101
3 AppKit 0x00007fff9edb9c5f -[NSWindow(NSWindowSharedFirstResponder) _changeAllAttachmentsFirstResponder] + 22
4 AppKit 0x00007fff9edb9acb -[NSWindow _realMakeFirstResponder:] + 659
5 AppKit 0x00007fff9edb97e4 -[NSWindow makeFirstResponder:] + 123
6 AppKit 0x00007fff9ee3c4c1 -[NSWindow _selectFirstKeyView] + 865
7 AppKit 0x00007fff9ee3c133 -[NSWindow _setUpFirstResponder] + 232
8 AppKit 0x00007fff9ee3af3d -[NSWindow _doWindowWillBeVisibleAsSheet:] + 169
9 AppKit 0x00007fff9f5a163e -[NSWindow _reallyDoOrderWindowAboveOrBelow:relativeTo:findKey:forCounter:force:isModal:] + 1514
10 AppKit 0x00007fff9ee396ce -[NSWindow _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 1041
11 AppKit 0x00007fff9ee39263 -[NSWindow orderWindow:relativeTo:] + 153
12 AppKit 0x00007fff9eeebbab -[NSWindow makeKeyAndOrderFront:] + 111
13 QuickLookUI 0x00007fffa6cbd519 -[QLSeamlessDocumentOpener showWindow:contentFrame:withBlock:] + 108
14 AppKit 0x00007fff9eeead37 -[NSWindowController showWindow:] + 689


I can’t see that I’m doing anything wrong - the hosting window (parent) does have -initialFirstResponder set to an outline view IN ITS OWN WINDOW. The drawer part has nothing to do with it - I’m not even making the drawer part myself, it has no existence within the nib, I only provide its content view.

Is it reasonable to suggest this is an Apple bug? I understand Drawers are a thing of the past, so maybe Apple doesn’t bother testing them properly, but for now I don’t have time to revise my design, so a drawer it is.

—Graham


Trying to make Arc happy

Gerriet M. Denkmann
 

I just switched on: Implicit ownership types on out parameters = CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE

and now I get complaints about stuff like:

- (BOOL)isNiceAndHas: (NSArray **)friends;

Method parameter of type ‘NSArray *__autoreleasing *' with no explicit ownership

How can I help Arc to understand what is going on? Any annotations to be used?

Gerriet.


Re: Drawer window error

Bill Cheeseman
 


On Jul 17, 2017, at 8:13 PM, Graham Cox <graham@...> wrote:

I can’t see that I’m doing anything wrong - the hosting window (parent) does have -initialFirstResponder set to an outline view IN ITS OWN WINDOW. The drawer part has nothing to do with it - I’m not even making the drawer part myself, it has no existence within the nib, I only provide its content view.

Is it reasonable to suggest this is an Apple bug? I understand Drawers are a thing of the past, so maybe Apple doesn’t bother testing them properly, but for now I don’t have time to revise my design, so a drawer it is.

If you Google this enough, you'll find several threads reporting this error message in macOS Sierra 10.12 over the last year or so, including one from me. The conclusion of the discussion, including my personal conclusion, is that this is a harmless message and can be ignored. Someone reported that the message is gone in High Sierra, but I haven't yet verified that myself.

My main app will continue to use drawers for the first little while into High Sierra, for the same reason you give. I am in the process of rewriting it in Swift and will take that opportunity to completely redesign the UI.


-- 

Bill Cheeseman - wjcheeseman@...


Re: Game Center Multi-Player Question

Dave
 

Hi,

Thanks for the advice.

I would associate a small number of AI with each player. 
This way, if a player quits, only a few AIs are killed.

I’m not quite sure how I would go about implementing the AI’s though, this is a turn based board game and as far as I can see, only “Real” players get a Move, so 

If you have:

Dave, Sue, John   Human
HAL, Marvin, R2D2 AI

Then how would it know that it was the turn of an AI Player?

I can see I may have to have two modes, single player and multi player and only support Human Players in Multi Player mode.

All the Best
Dave

On 17 Jul 2017, at 19:54, Pascal Bourguignon <pjb@...> wrote:


On 17 Jul 2017, at 19:40, Quincey Morris <quinceymorris@...> wrote:

On Jul 17, 2017, at 07:21 , Dave <dave@...> wrote:

As far as I can see, this approach won’t work with Game Centre, does anyone know if this is correct?

That’s correct. Game Center doesn’t provide any kind of “server side” logic, which is how you’d naturally want to implement AI players.

The only thing you can do with a Game Center game (other than implement your own server elsewhere, of course), is to put the “server” logic in a device or devices. You can, for example, elect one of the real player devices to supply the logic of all of the AI players. Or, you can replicate the logic in all devices (by using a seeded pseudo-random-number generator and deterministic behavior) so that each real device knows what all AI players will “do”. Something like that.

The downsides are that this is not terribly secure (a determined hacker can at least find out what the AI players will do in advance), and it complicates matchmaking. (It may also make your app bigger and slower, if the AI computations are significant.)

I would associate a small number of AI with each player. 
This way, if a player quits, only a few AIs are killed.


-- 
__Pascal J. Bourguignon__





Re: Game Center Multi-Player Question

Dave
 

I’m wondering if " anonymousGuestPlayerWithIdentifier:” might work for what I want to do, but I can’t seem to find much information about it.

Has anyone used this feature?

All the Best
Dave

On 18 Jul 2017, at 11:37, Dave <dave@...> wrote:

Hi,

Thanks for the advice.

I would associate a small number of AI with each player.
This way, if a player quits, only a few AIs are killed.
I’m not quite sure how I would go about implementing the AI’s though, this is a turn based board game and as far as I can see, only “Real” players get a Move, so

If you have:

Dave, Sue, John Human
HAL, Marvin, R2D2 AI

Then how would it know that it was the turn of an AI Player?

I can see I may have to have two modes, single player and multi player and only support Human Players in Multi Player mode.

All the Best
Dave

On 17 Jul 2017, at 19:54, Pascal Bourguignon <pjb@...> wrote:


On 17 Jul 2017, at 19:40, Quincey Morris <quinceymorris@...> wrote:

On Jul 17, 2017, at 07:21 , Dave <dave@...> wrote:

As far as I can see, this approach won’t work with Game Centre, does anyone know if this is correct?
That’s correct. Game Center doesn’t provide any kind of “server side” logic, which is how you’d naturally want to implement AI players.

The only thing you can do with a Game Center game (other than implement your own server elsewhere, of course), is to put the “server” logic in a device or devices. You can, for example, elect one of the real player devices to supply the logic of all of the AI players. Or, you can replicate the logic in all devices (by using a seeded pseudo-random-number generator and deterministic behavior) so that each real device knows what all AI players will “do”. Something like that.

The downsides are that this is not terribly secure (a determined hacker can at least find out what the AI players will do in advance), and it complicates matchmaking. (It may also make your app bigger and slower, if the AI computations are significant.)
I would associate a small number of AI with each player.
This way, if a player quits, only a few AIs are killed.


--
__Pascal J. Bourguignon__



GKSession - More Game Center Question

Dave
 

Hi All,

I have a Question about GKSession and about turn based games in GC in general.

Firstly, do I *need* to use GKSession in order to create a Turn Based Game? If so, then it looks like I will also have to enable iCloud as a capability of my App?

My other question relates the the Game Center documentation. All I can find online is the XCode HTML based docs, is there a PDF available for GameKit? Trying to learn something as complex as this using HTML is like pulling teeth. I sooooooo wish Apple would supply the PDFs again. Whoever thought the current document system was in any way better for the end user than having a collection of PDFs needs serious physiological help.

All the Best
Dave


Re: GKSession - More Game Center Question

Dave
 

HI,

I said GKSession in my last post, I was looking at “GKTurnBasedEventListener” and I’m wondering if I can use “GKTurnBasedMatch” without having to worry about “GKSession” and/or the iCloud.

Cheers
Dave

On 18 Jul 2017, at 15:32, Dave <dave@...> wrote:

Hi All,

I have a Question about GKSession and about turn based games in GC in general.

Firstly, do I *need* to use GKSession in order to create a Turn Based Game? If so, then it looks like I will also have to enable iCloud as a capability of my App?

My other question relates the the Game Center documentation. All I can find online is the XCode HTML based docs, is there a PDF available for GameKit? Trying to learn something as complex as this using HTML is like pulling teeth. I sooooooo wish Apple would supply the PDFs again. Whoever thought the current document system was in any way better for the end user than having a collection of PDFs needs serious physiological help.

All the Best
Dave





How to Log Off from Game Center using the Simulator?

Dave
 

Hi All,

Using the Simulator, how can I log off from Game Centre? I’ve logged on ok once, but now I want to test it again from not being logged in.

Thanks a lot
Dave


Re: Trying to make Arc happy

 


On Jul 18, 2017, at 1:07 AM, Gerriet M. Denkmann <g@...> wrote:

- (BOOL)isNiceAndHas: (NSArray **)friends;

Method parameter of type ‘NSArray *__autoreleasing *' with no explicit ownership

I think you resolve this by changing it to the form shown in the error messages, i.e.

- (BOOL)isNiceAndHas: (NSArray *__autoreleasing *)friends;

—Jens


To do list need help adding row to table view from a bar button item.

Taylor Arndt
 

Hi,
So my to-do list is almost done, and I have one problem, I imbedded my
table view controller in a navigation controller and all is well, until
I try to add a row to the table view, o we have a problem. Basically
how to make an action with a bar button item? code is below.
tasks table view controler
//
// tasksTableViewController.swift
// todo lists
//
// Created by Taylor Arndt on 7/17/17.
// Copyright © 2017 Taylor Arndt. All rights reserved.
//

import UIKit

class tasksTableViewController: UITableViewController {

override func viewDidLoad() {
super.viewDidLoad()

// Uncomment the following line to preserve selection between
presentations
// self.clearsSelectionOnViewWillAppear = false

// Uncomment the following line to display an Edit button in
the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

// MARK: - Table view data source

override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}

override func tableView(_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return name.count
}

/*
override func tableView(_ tableView: UITableView, cellForRowAt
indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier:
"Task", for: indexPath)

// Configure the cell...

let name = name[indexPath.row]

cell.nameLabel.text = name.name


return cell
}
*/

/*
// Override to support conditional editing of the table view.
override func tableView(_ tableView: UITableView, canEditRowAt
indexPath: IndexPath) -> Bool {
// Return false if you do not want the specified item to be editable.
return true
}
*/

/*
// Override to support editing the table view.
override func tableView(_ tableView: UITableView, commit
editingStyle: UITableViewCellEditingStyle, forRowAt indexPath:
IndexPath) {
if editingStyle == .delete {
// Delete the row from the data source
tableView.deleteRows(at: [indexPath], with: .fade)
} else if editingStyle == .insert {
// Create a new instance of the appropriate class, insert
it into the array, and add a new row to the table view

name.apend() }
}
*/

/*
// Override to support rearranging the table view.
override func tableView(_ tableView: UITableView, moveRowAt
fromIndexPath: IndexPath, to: IndexPath) {

}
*/

/*
// Override to support conditional rearranging of the table view.
override func tableView(_ tableView: UITableView, canMoveRowAt
indexPath: IndexPath) -> Bool {
// Return false if you do not want the item to be re-orderable.
return true
}
*/

/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a
little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/

}


task.swift
//
// task.swift
// todo lists
//
// Created by Taylor Arndt on 7/17/17.
// Copyright © 2017 Taylor Arndt. All rights reserved.
//
import Foundation

var name=[ String]()
I would appreciate any help with this project, as I have came a long
ways doing it.
Taylor




--
Taylor


Game Center loadPlayersForIdentifiers deprecated - How to fix?

Dave
 

Hi,

I’m getting a warning on this method:

[GKPlayer loadPlayersForIdentifiers:theMatch.playerIDs withCompletionHandler:^(NSArray* thePlayerArray,NSError* theErrorInfo)

It says to replace it with “players”, however this won’t fix it, it will break it, since the above is working with PlayerIDs not Player Objects. So, should write a method that gets the Array of Player Objects, then creates a new array of PlayerIDs by iterating over the Player Objects? This seems like a giant waste of time, since it just means I’m doing the work instead of GKPlayer, not sure why is was deprecated?

All the Best
Dave

81 - 100 of 1475