Migrate xib file to Xcode 4.4 - xcode

This should be an easy one, but surprisingly I could not find any information about it being or not being possible to do.
I have some .xib files created in older versions of Xcode/Interface Builder and I would like to use Xcode 4.4's new features but so far I've only been able to achieve this by deleting the older .xib files and creating new ones from scratch.

You may need to update the older xib files' development target. Select the xib file from the project navigator and open the file inspector. In the file inspector's Interface Builder Document section is a Development menu. Try updating the development target to Xcode 4.4 and see if that allows you to take advantage of the new Xcode 4.4 features.
If updating the development target doesn't work, you'll have to provide some more information about the problems you're having and the features you haven't been able to access.

Related

How do I build a Safari Extension Companion in Xcode 8.2.1? the template is missing

I want to create a Safari Extension Companion, but the option to create a Safari extension doesn't appear.
What is the right way to create an extension?
To create a Safari app extension, you add a new target to an existing project in Xcode. — mentioned in the documentation.
Launch Xcode and open an existing project containing an OS X application, or create a new one.
Create a new target by choosing File > New > Target.
In the New Target sheet, look in the sidebar on the left and select OS X Application Extension.
From the list of templates on the right, select Safari Extension and click Next.
Enter a Product Name for your extension, such as “My Extension.”
Make sure that your application project is selected in the Project menu, and that your OS X application target is selected in the Embed
in Application menu.
Click Finish.
When Xcode asks you if you want to activate a new scheme for your new extension, click the Cancel button.
Xcode adds a new group into your project, which contains several new files, including an Info.plist file, a variety of supporting source files, an Interface Builder file, a JavaScript file, and a toolbar image PDF.
* There might be a few more steps, although I'm pretty sure you can handle it...
↳ Add a Safari App Extension Target in Xcode
The easiest way is to just install Xcode 7 side-by-side with Xcode 8 - this works fine - and load your project in 7. Create the extension companion target, but don't do anything with it yet. Close Xcode 7 and open Xcode 8 to the same project/workspace, and you'll see the companion. If you use Swift you'll need to modernize the language (Xcode 7 uses Swift 2, Xcode 8 uses Swift 3); the IDE will suggest some of the changes directly when you try to compile but others you may need to change by hand.
Alternatively / more awkwardly, you can create a new target (such as a Safari Extension) in Xcode 8, and then delete the extraneous files (such as JavaScript for content injection) and edit/replace the plist in the extension to the plist of an extension companion. The key property is <string>com.apple.Safari.extension-companion</string> for the NSExtensionPointIdentifier; also make sure that the NSExtensionPrincipalClass implements the extension companion protocol (both of these keys are under NSExtension).
Please be aware that I've had mixed results with this approach. Sometimes it works, sometimes Safari pretends it can't see the extension companion at all, sometimes the extension can't see the companion until you re-load it and then it can... If you can see the extension companion, it should work (but note the warning here about if the companion crashes) and I haven't found any logging that helps troubleshoot these issues. Attempting to debug the extension companion using Xcode 8 doesn't work for me either.
I really wish Apple didn't insist so hard on "thinking different" and just supported Native Messaging like every single other modern browser.

The document "XXXX.xib" could not be opened. Could not read archive

After opening my project in the Xcode5 developer preview, errors appeared against a few .xib files when I tried to open the project in Xcode 4.5. The error text was:
The document "XXXX.xib" could not be opened. Could not read archive.
Please use a newer version of Xcode. Consider changing the document's Development Target to preserve compatibility.
The project's development target in Xcode5 appears to be iOS 5.0.
Looking at the source code of the .xib files with errors, it is clear that the .xml structure for .xib files in Xcode5 has changed quite dramatically, and it needs to be reformatted to be backwards compatible.
Is there a way to set development targets for specific .xib files? Does anyone know how this error can be resolved?
Many thanks.
Just open Storyboard in XCode 5, into right panel and "File Inspector" tab do:
edit your "Interface Builder Document" like follow:
Save it and open in previous XCode.
First of all open project with Xcode5. and then
select XXX.xib find Interface Builder Document
Opens in Xcode 4.6(if is 5.0)
close project
open it with 4.6
A better and easier solution that works even if your project isn't under source control can be found here (mine):
Just installed xcode 5 and have missing storyboards
Hope that helps.
It's a current problem when you open your Xcode 4.6 project with the new XCode 5.
To reuse correctly your XIB with Xcode 4.6 :
1 Open your project with XCode 5
2 Select your Xib to restore
3 In the File Inspector Section, in "Interface Builder Document",
select Xcode 4.6 in the Development's version of Document Versioning
4 Build and close
5 Reopen your project with XCode 4.6
It's possible to have some regression with elements width & size in your XIB, but it was restored successfully.
Cheers,
well obviously you created your project prior to the new xcode developer preview. then you tried opening your project with the new DP and boom, it automatically changed everything in your xibs to be able to present your xibs in a higher version. easy to fix. with your xcode 4 ios 6 open the same project, then right click on the name of the xib that is not opening and select source control and from there select discard changes. that should return the xib back to the shape it was before you opened it with the new xcode DP.
let me know if you need more help but that should take care of your problem.
First you have to open your's project with newer version of Xcode.
Right click on XXX.xib file and select "Show File Inspector."
Go to Interface Builder Document.
Change Development option with older version of Xcode.
Once I used to manage a project with XCode 5 xibs in XCode 4. I split xibs for each XCode version and made this build script that compiles xib to nib and place that nib them inside the app
#get SDK version
SDK_VERSION=$(echo $SDKROOT | sed -e 's/.*iPhone\(OS\)*\(Simulator\)*\([0-9]*.[0-9]*\).sdk/\3/')
if [ $SDK_VERSION == '7.0' ]; then
echo 'Current SDK is 7.0'
ibtool --compile ${TARGET_BUILD_DIR}/${TARGET_NAME}.app/output.nib ${PROJECT_DIR}/ProjectFolder/input.xib.xib
echo 'Copied nibs to' ${TARGET_BUILD_DIR}/${TARGET_NAME}.app
else
echo 'Current SDK is not 7.0 (SDK is' $SDK_VERSION')'
fi

No derived data for builds after upgrading to Xcode 4.5

I have a MacBook Pro that has Mac OS X 10.7.5. I was doing iOS development using Xcode 4.4 and I recently upgraded to Xcode 4.5.
For my application, I have built some 3rd party libraries that it depends on, and those libraries need to be placed in a certain location so my application can pick them up and use them. However I'm unable to locate the recent builds of the libraries because, even though Xcode says the libraries build successfully, nothing is available for derived data in the Organizer.
What can I do to determine where these libraries are being built?
In Xcode 4.5 look at Preferences->Locations.
This shows where your Derived Data location actually lives on the File System.
Click on the arrow next to the Derived Data path to show the path in the Finder.
I recently upgraded from Xcode 4.3.3 and found that the build location has been automatically changed to Custom, so my (debug) build products are now in:
~/Library/Developer/Xcode/DerivedData/Build/Products/Debug
I am guessing that Apple have made this change to simplify the location of build products in a single location. In Xode 4.3.3 for example build products were placed under:
~/Library/Developer/Xcode/DerivedData/XXX
where XXX is a randomly generated folder based on your Xcode project name.
I have also found it useful to enable hidden folders to be displayed in the Finder so that you can actually browse the contents of your Library folder. I used the free Onyx tool to enable the display of hidden folders.
Hope this is of some help.
I went into Organizer, right clicked on the project which was no longer generating derived data (even though I could see it was... just the delete button was greyed out) and removed it from organizer. When I reopened the project it button was available again

Monodevelop migrate 2.8 didn't add .h files

I just upgrade my MonoDevelop to the latest version (2.8). I also installed XCode4, since it's fully supported now. When opening my solution (which consists of several projects) I was asked to migrate my solution. I did this and saved everything.
However, I think something is missing. When I open the .xib file, the project on the right doesn't show .h files, like shown in the tutorial.
It also shows warnings that the outlets were not found in XCode.
When I add a new screen, it creates the .h file as it should and shows this in XCode. However all existing screens don't have these files, which makes it impossible to add/change outlets.
How can I fix this.
Check that your classes you expect to see in Xcode have explicit [Register("SomeName")] attributes, which register them with a name usable from Xcode/Obj-C/IB.
I would expect an imported project to have those attributes already, since they're required for xibs to be able to load the classes by name, but you could maybe have got away without those attributes by using outlets on "File's Owner".

Can't create iPad XIB with Xcode 4

Alright, I have a problem on my hands. I'm trying to convert my project to a universal app for the iPhone and the iPad. I'm trying to make iPad-specific versions of my XIB files. As it's not possible to Create iPad version using autoresizing masks in Xcode 4, I assumed I'd just be able to pop my XIB into Xcode 3's version of IB, and let that do the magic. No dice. Here's the error I get when i try to open the XIB file in IB:
To be honest I don't know where to proceed from here. I guess I could just resize my views manually, but that's quite tedious and I don't really have the time to be doing that. Any ideas?
Alright, I figured out a rather convoluted workaround.
First of all, duplicate your original project and then select your project info. Right-click on your target, and select "Duplicate".
Xcode will then pop up this message. Select "Duplicate and Transition to iPad".
Now Xcode converts the XIB files for you, and presents you with an iPad resources folder.
Now open these XIB files in the Finder, and append ~ipad after the file name.
After doing so, copy these XIB files back into your original project, and then turn your project into a universal project by selecting from the dropdown in your target settings.
And you're done. I found that really convoluted, and I'm hoping Apple can fix this huge usability problem soon.
This should not happen. One way to fix this problem would be t completely remove the Xcode 4 Installation and re install it from scratch . And then re install it.
Use the following command to uninstall and re install Xcode 4
sudo [xcode-path]/Library/uninstall-devtools --mode=all
PS: If you are creating projects in Xcode 4 that you also want to open in Xcode 3 make sure you keep Document Versioning section to Interface Builder 3.1

Resources