I "upgraded" to XCode 9 today, hoping that it would support the new ISO Appendix K safe string functions (it doesn't). It has always been difficult to get XCode to update a Mac application's Help Book. In the past I have been able to do it by following these instructions:Delete any other versions of the app and empty the trash.Update the Help.plistCreate a new Help.helpindex file using the Help IndexerRemove the help folder from project.Delete the system’s cached help folder using the terminal command: rm -rf ~/Library/Caches/com.apple.help*Sometimes it helps to restart your machine nowSometimes it helps to execute the termanal command rm -rf ~/Library/Caches/com.apple.help* againClean and rebuild the project without the Help folderAdd the new Help folder, clean and rebuildCheck to be sure that the new help book is addedNow this doesn't work. When I run my project with the new Help Book the Help Book window says:The selected topic is currently unavailable.The topic you were trying to view could not be found.XCode logs:2017-09-20 13:45:49.466114-0600 app[2349:187674] Entering AHRegisterHelpBookWithURL2017-09-20 13:45:49.466228-0600 app[2349:187674] Entering AHRegisterHelpBookWithURL: 0Can anyone tell me how to get XCode 9 to do this?
Post
Replies
Boosts
Views
Activity
I put a new build on iTunes but I haven't submitted it for review. I wan't to submit this same version and build with a minor change before I do. I can't figure out how to delete the existing build on iTunes Connect Can. this be done?
When I set the icon for a file using[[NSWorkspace sharedWorkspace] setIcon: myImage forFile: [[sheet URL] path] options: NSExcludeQuickDrawElementsIconCreationOption];2019-11-21 14:34:44.954590-0700 Appname[4856:152311] [default] Invalid image size X: 1024 Y: 1152XCode 11.2.1 correctly sets the file icon to myImage but logs the error 14 times. This didn't happen in older versions of XCode. The Developer Documentation doesn't say anything about any particular requirements for the size if the NSImage. Setting the the options to either one of the two options doesn't change the error. Is this a spurious error? Am I missing something. Should I file a bug report?
I’m trying to re-design a window in an .xib with XCodde 11.2.1. I want to delete an NSView but I can’t. I can’t drag it to the trash. When I highlight it in the hierarchy pane the Cut and Delete items are disabled. Using all of the possible modifier keys does nothing. I tried to drag it to the last position in the hierarchy but it still can’t be deleted and it also copies all of its sub-elements. If I cut and paste it it also copies all of its children in the hierarchy. The only way I can figure out how to do delete it is to start over with a new .xib and laboriously reenter all of the sub-views and manually reconfigure them. Is there any way to delete a view from the hierarchy? Isn't this this a bug? Is it a feature request? Should I file a bug report?
I read the Apple Help Programming Guide. I very carefully re-organized my help book folders so the help book is localized (which I don't need to do). I had to edit the HTML files to get some links to work. Now that I renamed my help book folder to a .help it's a bundle and the file opening dialog in the 2015 Help Indexer application won't open it so I have to create a folder with a copy of the files and use that to create an index since the Help Indexer application doesn't support drag and drop either. Should I be indexing the .help bundle or the English.lproj folder that contains the index in the examples?
The documentation is ambiguous, In the Help Book Registration section it gives two examples of how to register the help Book. First it says the <key>CFBundleHelpBookFolder</key> should be <string>SurfWriter.Help</string> then in the illustration it has it as Surf Writer Help. Then it has the <key>CFBundleHelpBookName</key> as <string>com.mycompany.surfwriter.help</string> but in the illustration it has it as Surf Writer Help. Which is it?
The help Book is still not searchable but I'll clear the cache with the terminal command: rm -rf ~/Library/Caches/com.apple.help* and see if it helps.
Like almost all of the Developer documentation the Apple Help Programming guide is not current and needs work.
Sorry if these questions have been asked before. The Developer Forums seem to be broken. No matter what I search for there are no previous posts.
I have been using this code for a long time to get App Store reciepts:
NSError *theError = nil;
NSBundle *mainBundle = [NSBundle mainBundle];
NSURL *appStoreReceiptURL = [mainBundle appStoreReceiptURL];
NSData *receiptData = [NSData dataWithContentsOfURL: appStoreReceiptURL options: NSDataReadingMappedAlways error: &theError];
if (!receiptData) {
NSURL *receiptURL = [mainBundle URLForResource: @"receipt" withExtension: @""];
receiptData = [NSData dataWithContentsOfURL: receiptURL options: NSDataReadingMappedAlways error: &theError];
}
Now it has stopped working. I have had to use both methods to get a URL to the _MASReceipt/ directory because XCode seems to do it differently when debugging. Now the application crashes the second time I try to get recieptData. Both methods return a URL with a path to @"Contents/_MASReceipt/reciept. The first time I use dataWithContentsOfURL the error and data ptr are nil. The second time the app crashes and I get a warning that the app is damaged and to download a new copy from the App Store. Looking at the build folder it appears that XCode isn't creating a _MASReceipt folder.
Do I have to put some special build instructions in the project to fix this? Why did this stop working?
Before when I couldn't get a valid receipt the program would exit and ask me to enter my test user id and password. Then it would attach a valid receipt and run the app.
I have an NSSavePanel with a custom accessoryView in my Mac OS application. The accessory view is a popup menu with a list of file types that the user can use to save the file. I can initialize file name to be saved with a default .type when I am initializing the NSSavePanel, using [savePanel setNameFieldStringValue: (NSString*)fileName]; but not when I run the panel with [savePanel runModal]. The IBAction that is called when the user selects a new file extension creates a file name with the new file type extension but when the IBAction invokes the [savePanel setNameFieldStringValue: (NSString*)newFileName]; the name isn't updated in the panel. The savePanel and its nameFieldString don't respond to the setNeedsDisplay method. This needs to work so that the user can see what type of file he is saving to and also the savePanelDidEnd method uses this name to create a URL for saving the file with the file name and extension. There is a delegate method for the NSOpenSavePanelDelegate, panelSelectionDidChange. If I implement this as a delegate method will it work?
The thin and very old developer documentation describes how to attach an accessory panel but not how to make it change the fileName.
I recently switched to Mac OS 12 and XCode 13. I did some work on my application and rebuilt it. Now there is no Help Book. I didn't change the property lists and everything looks right. When I open the Help Book the application either opens a window with a message that the content is currently unavailable or it opens a Help Book window with no content. When this second thing happens the log window shows "entering AHRegistered help Book" but it doesn't appear. Does anyone have any suggestions?
There are a lot of other questions in the forums like this but they are so old that I thought I should start a new one.
I want to add an outlet connection from my file's owner to an NSButton in a .xib. I can't do it.
The NSButton is declared as an IBOutlet NSButton *myButton; in my .m file. In my .xib the button's class is declared as NSButton.
When I control drag from the NSButton in Interface Builder to the File's Owner's New Referencing Outlet well in the pop-up or the File's Owner in Placeholders nothing happens. There are three other IBOutlets that were in my .m file that are connected. Since I upgraded to XCode 13.3 I can't connect the fourth IBOutlet in my .m file to objects in my .xibs.
This has always been easy but now it can't be done in XCode 13.3. I spent a LONG time trying to do this but I can't.
The Help documentation doesn't even begin to resemble what I actually see in XCode at all, starting with:
"In Interface Builder, open the assistant editor (choose View > Assistant Editor > Show Assistant Editor)". What? There's no such menu item in the View menu.
Is this a new super horrible bug in XCode? Should I file a bug report? Does anyone else have this problem?
I have some NSPanels that are not resizable, the App is not localized and and don't need Layout Constraints. Any time I edit an NSText field in the .xib, XCode 14.2 starts to report many errors: "Views without any layout constraints may clip their content or overlap other views." I spent a lot of time trying to make XCode stop reporting these warnings, but I can't. Sometimes quiting XCode or restarting my Mac will make these go away.
According to XCode Help: "Auto Layout is enabled by default. To disable Auto Layout, choose View > Inspectors > Show File Inspector and deselect the checkbox for Use Auto Layout."
Too bad there isn't any checkbox for Use Auto Layout in the file inspector for the .xib, the .panel's view or the NSText Field so I can't actually do this. The editor>Layout>Automatic menu item is disabled. Is there really any way to disable Auto Layout or has Apple decided to require it?
This morning my xCode project stopped building. I'm using XCode 14.2 and Mac OS 12.6.6. A .h file has been in the project for years and the project has been built hundreds of times with this file. Today XCode stopped building the project with two errors;
The .h C header file has only this:
#include <stdio.h>
void func(char *foo, char *bar);
XCode reports an error:
Expected identifier or '(' with the underscore unuder the void return type.
Obviously this is a spurious error.
Also the analyzer reports:
header 'headerfilename.h' is not a member of any targets in the current scheme that build for running. XCode shows that this is in the project in the Identity and Type pane. The project shows this in the pane but with header files the check box is not checked - only .c and .m files, so this is apparently a spurious error as well.
This is weird because I didn't do anything to change this. Also there are a lot of other .h files in the project that are used.
In, order to fix this I have cleared the build folder and rebuilt the project. removed the .h file from the project and built the project, then added it and built it with the .h file in the project. In Identity and Type info pane the .h file shows Target Membership in the project. I removed the whole group with the file and added it again being sure to check the box for target membership but it still won't build this .h file. Other files are added to the group but not this one.
I have experienced a lesser version of this before with .h files but after building the project a couple of times XCode fixed itself. Not this time. XCode got up this morning on the wrong side of the bed and it decided it won't build with this header and I can't add it to the project.
Any suggestions?
I want to use the newer APIs in the Store Kit to validate receipts. The methods to do this are described in the documentation but with one thing missing - the necessary frameworks and headers. Linking against the AppKit and StoreKit frameworks doesn't help. What frameworks and headers would I need to get XCode to recognize for example, AppTransaction?
Also some of the documentation is in Swift only. Is this a subtle hint that Apple is moving towards a Swift-only development environment?
I’m trying to add a window to myMacOS application that will displace html content. I have a .xib with a window with a WKWebView. In my NSWindowController subclass implementation I have an IBOutlet WKWebView *myWebView. The outlet is connected to the WKWebView in the .xib
I initialize my subclass of NSWindowController with:
self = [super initWithWindowNibName: @“WindowName”];
Then in the windowDidLoad method I initialize the WKWebView with code like this:
WKWebViewConfiguration *webConfiguration = [[WKWebViewConfiguration alloc] init];
[webConfiguration defaultWebpagePreferences];
myWebView = [[WKWebView alloc] initWithFrame: [myWebView frame] configuration: webConfiguration];
[webConfiguration release]; //Yes, I know I could use ARC
[myWebView setUIDelegate: nil];
This looks fine in the debugger and doesn’t log any errors.
Then I can create and load a URLRequest with Apple’s example:
NSURL *appleURL = [NSURL URLWithString: @"https://www.apple.com"];
NSURLRequest *myURLRequest = [NSURLRequest requestWithURL: appleURL];
[myWebView loadRequest: myURLRequest];
In order for this to work I have to check the Network Incoming Connections (Server) box in the target’s App Sandbox. (It would be EXTREMELY helpful if this was mentioned in the Developer Documentation)
OR I can get file URLs and folders from the Application Bundle and load than with:
[myWebView loadFileURL: helpFileURL allowingReadAccessToURL: helpBundleURL];
In order for this to work I have to check the Network Outgoing Connections (Server) box in the target’s App Sandbox. (It would be EXTREMELY helpful if this was mentioned in the Developer Documentation)
Then when the window is opened and displayed the WKWebView remains blank.
No errors are logged. XCode logs: “WebContent process (0x150001200) took 1.3841 seconds to launch.” so XCode seems to think that the web content was loaded correctly but the WKWebView remains blank. Trying to force it to display with methods like reload and setNeedsDisplay: YES don't fix it.
How can I get the WKWebView to actually display the content?
Xcode is adding un-wanted menu items to the Edit menu in a Mac Application. There is an automatically generated separator bar and an AutoFill menu item with two sub-menu items. Looking at the source code I see that two other items were suppressed in the initialize method of the AppController like this:
NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary];
//Get rid of Special characters menu item in edit menu:
[defaultValues setObject: [NSNumber numberWithBool: YES] forKey: @"NSDisabledCharacterPaletteMenuItem"];
//Get rid of Start Dictation... menu item in edit menu:
[defaultValues setObject: [NSNumber numberWithBool: YES] forKey: @"NSDisabledDictationMenuItem"];
[[NSUserDefaults standardUserDefaults] registerDefaults: defaultValues];
I guessed that there would also be a key like this: @"NSDisabledAutoFillMenuItem" but adding this to the code does nothing so apparently not.
I searched programming forums and posters say that you can fix this by changing the name of the Edit menu to something like (space)Edit but this doesn't work.
I searcher the Developer documentation and the Archives extensively for info about these keys but of course found nothing. Control-clicking on these pops up a menu of ways to search for these but none of them find anything. Control, option and command clicking on these keys results in ”?”.
I can probably get a pointer to the menu and use NSMenu’s methods to delete these but something like the above would be better. Is there any documentation about this anywhere?