iOS 5.1 crashes when using collections view - ios

I am trying to use collection view and I want to support 5.1. I am not using story board. I have added collectionview to my view controller. I am identifying the version and opening collection view if its 6.0 or higher else opening another view controller. When I run my application in 5.1 it immediately crashes with error :
Symbol not found: _UICollectionElementKindSectionHeader
I have seen the link below it only describes the case when you use story board.
How to use UICollectionViewController in storyboard while still supporting ios 5.1?
Any help would be appreciated.
Thanks

Are you sure you've set your deployment target to iOS 5.1 in your app target in your project?
That should cause the following:
"...Framework APIs that are unavailable in earlier versions will be weak-linked..."
(from the quick help of IPHONEOS_DEPLOYMENT_TARGET).
If it's crashing immediately upon launch, it sounds like it's not being weak-linked.
If you're sure you've set a deployment target of iOS 5.1, you could try forcing the entire UIKit.framework to be weak-linked to troubleshoot the issue. To do that, you mark it as Optional as opposed to Required in the Linked Frameworks and Libraries section:
FWIW, I've been able to successfully do what you're describing in a Mac OS X application: I have an app built against the latest SDK, and at runtime, check the version of OS X and load different nibs. In the nibs for later versions of OS X, I can make use of UI elements that did not exist in earlier versions of OS X. Provided your app is nib-based, I can't see why you wouldn't be able to do the same in iOS. (Note that if you're using storyboards, that's a different story).
Here's an example project of how to set it up:
http://www.markdouma.com/developer/CollectionViewFinagler.zip

UICollectionView is not supported in iOS5. You can only use it with iOS6 apps. Sorry, but you are out of luck with it.
Here is an open source project that should help you out though, as it is defined:
Open Source, 100% API compatible replacement of UICollectionView for
iOS4.3+

Related

(Class) is unavailable: cannot find swift declaration for this class ONLY for iPhone <= 5 simulator, Generic iOS Device and Release Build

I understand that many similiar questions have been asked in the past - however, none of them exactly applies to my situation.
I am using the AudioKit framework in my app. I added the framework by copying the framework into the app directory and adding it to embedded binaries. It runs perfectly on the iOS simulators after the iPhone 5 simulator (i.e. 5S plus). However, when building for: earlier simulators; Generic iOS Device; and my device (which is an iPhone SE) I get the error (Class) is unavailable: cannot find swift declaration for this class where (Class) is every single AudioKit class in my code.
As per this answer I've checked the framework's Modules folder and the only files there are x86_64.swiftdoc and x86_64.swiftmodule. As I understand, to build for a real iOS device I need an arm64.swiftmodule. However, I cannot figure out how to create this file/where to find it.
The linked question would suggest that I need to change the framework's deployment target, but I can't figure out how to change it (or even where the framework's deployment target is stated).
I have tried creating a new xCode project, building it from the start for Generic iOS device, then adding the AudioKit framework - but I still get the same errors.
Finally decided to give up trying to make it work. Used Carthage instead - works perfectly. If anyone else has this issue - just use Carthage.

Error - "Class is unavailable : Cannot find Swift declaration for this class", while building app on iPhone 4s (iOS 9.3)

My App has been created under iOS 10.2, and when I'm trying to create a build of the app to run on iPhone 4s (iOS 9.3).
I'm using two frameworks :-
ViewModelExtensions.framework (github.com/jozsef-vesza/ExpandingTableView/tree/master/ExpandingTest/Carthage/Checkouts/ViewModelExtensions/ViewModelExtensions)
ExpandingTableView.framework (github.com/jozsef-vesza/ExpandingTableView) in my project.
I'm not able to create a built for my project. Its giving me 3 main errors as follows :-
ExpandingTableViewController is unavailable: cannot find Swift declaration for this class
ExpandingTableViewCell is unavailable: an not find Swift declaration for this class
Use of undeclared type ViewModelType
The thing is its perfectly running on all simulators supporting iOS 10.2. What shall I do ?
Here is the screenshot.Screenshot
My Code - Project
Reason your code not running is because one of the framework you have added Expandable tableView has minimum target requirement specified as 10.2 :) So you can not run it on anything less than iOS 10.2 :)
Now you can't change the frameworks minimum target, so change your projects development target :)
Solutions :
Change Development target to 10.2 in your project
Or get rid of the framework and find something that has minimum target as iOS 9 :)
We'll need more detail (code, did you use pods, etc.)
However, this looks like a problem with the referenced frameworks (I assume you've imported UIKit at least). I suspect (without seeing your code) that you're getting errors next to the frameworks above at build time. If so, there are a few things to check:
Make sure if you used cocoapods, you are using the 'workspace' and not the 'project' file.
Check and see if your "target membership" (you can see this in the inspector to the right of your class code) is set to the proper targets (i.e. your app - and probably nothing else at this point)?
If these checks fail, try re-installing the frameworks (again, depends if you used cocoapods or embedded them via Xcode (point 1 above)).

CCMenuItem doesn't work (Xcode 7.3~)

I’m a Japanese game developer. I develop some games with cocos2d-x.
I’m confused by the following problem. So, if you any idea, please help me.
When tap the button put on a cocos2d-x layer, the button doesn’t work.
If the button be tapped, the call-back function of the button doesn’t be called.
I have found some workarounds of the problem. However, I have no idea why the problem occurs. And, I want the most suitable way, how to fix it.
The following are develop environment and mobile devices that the problem occurs.
■ Develop environment
Operating system : Mac OS X El capitan(10.11.5)
Xcode version : 7.3 - 7.3.1(7D1014)
cocos2d-x version : cocos2d-x-3.2
build config. : Test / Release
■ Mobile devices
iPhone4s(iOS 9.3.2), iPhone5(iOS 9.3), iPad mini(iOS 9.3.1)
If mobile device's condition (iOS version etc.) is different, the problem may not occur.
And, the apps built by Xcode 7.2.1 or older version have no problem. it work normally.
The problem doesn’t also occur with the apps built by Debug build mode.
I attach a sample code.
https://github.com/SeanIchikawa/SampleProject/tree/master/CCBTest
The button of the layer is made by ccbi (ccbi = cocos builder file).
The call-back function is referenced to the button by "Selector" in the ccbi file.
■ About the sample Xcode project
Xcode Project name : CCBTest
ccbi file: Resources/simple.ccbi
Class file (written about layer) : Classes/SimpleView.h
If you any idea, please give me.
Thank you for reading my question.
The only way I've found at the moment to work it around is to downgrade Xcode to 7.2.1, having exactly the same problem but with CCButton instead.
Older Xcode versions can be downloaded from here: https://developer.apple.com/downloads/
This issue only occur if you are targeting a 32-bit architecture device with -Os optimization.
Set the optimization to -O1 in your release build could walk around this issue for now.

Building with iOS7 produces iOS6 looking widgets

After moving to XCode 5 and the iOS7 base SDK, some of the UI widgets in my app still look like iOS6-style (gradients, frames) on iOS7 devices. This doesn't happen on the equivalent emulator for iOS7. This also doesn't happen for all widgets, UIDocumentInteractionController's popup looks like iOS7 on device, but UIPopoverController doesn't. The keyboard for renaming a file also shows this discrepancy between emulator and device.
How does iOS determine the visual style of UI elements? Is it based on a statically linked library or something determined at runtime? I've tried purging the app from the device completely, but no change.
Emulator for retina iPad: UIPopoverController
iPad 3rd gen with iOS 7: UIPopoverController
The code in this case is fairly straightforward, no customization of the rendering or layout.
self.poController = [[UIPopoverController alloc] initWithContentViewController:audioCopyController];
[audioCopyController showDoneButton:NO];
audioCopyController.view.frame = CGRectMake(0,0,350,250);
_poController.popoverContentSize = audioCopyController.view.bounds.size;
_poController.delegate = self;
[_poController presentPopoverFromRect:view.audiocopyButton.frame
inView:view
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];
Thanks for the help in advance.
Check you Project config file and Target config file.
It is probably set with an iOS 6.X base SDK.
For this:
Go to your project config file in Xcode 5
Click the Build Settings tab
Edit the base SDK field to switch it to iOS 7.
Sometimes, we've experienced issues with Xcode not taking the current setting into account.
Changing it and compiling helps it understand that it needs to be changed.
Make sure you configure this correctly for your Project config and each and every target config file you run this from.
You might well have 2 different targets for simulator and for your devices.
Hope this helps
Regards
David
Ok, I found out what the problem was. David's suggestion got me thinking.
I am maintaining multiple apps at the same time, and one of them is quite old. The new Interface Builder in XCode5 breaks the transparency for a lot of the fields in the old app so I was keeping XCode4 in a separate installation folder alongside of XCode5. It seems that somehow my XCode5 project was still pointing at the SDK folders of XCode4 (not sure how this was possible, looking at the actual linker command line would probably shed some light), so after deleting XCode4's 6.1 SDK folder from my machine, a clean build with XCode 5 produced the correct iOS 7-looking widgets in my iOS-supported app.
The moral of the story is, be very careful with multiple XCode/SDK installations on the same machine. Hopefully this can help other folks who may be trying something similar to provide support for legacy apps.

Xcode is loading in OS X objects instead of iOS objects

I have an iOS window application, which was working fine with Xcode up until today.
When I open the project in the object library it seems to load in all of the OS X development objects, and I can no longer see any of the cocoa touch items like UITextViews, etc.
I didn't manually change any of the settings so I am not sure why this is happening.
Not sure if its the exact same problem, but I found that opening a .xib file switches the Object Library from OS X to iOS objects...
I downloaded Xcode 4.3.3 last night and had the same problem on my first launch of Xcode after the upgrade.
It certainly looks like a bug. My workaround: in the Build Settings, I changed the "iOS Deployment Target" pulldown to a different SDK, then changed it back. After that, I got the iOS objects back.
You can fix it by going File - New - File - Choose "Cocoa Touch" in iOS - choose "Objective-C class - Next - Choose options for your new file: select checkbox "With XIB for user interface"
Changing the deployment target to a different sdk didn't fix it for me.
However, opening up a storyboard brings back the IOS specific objects.
You probably added the Storyboard from the "macOS" tab. Was the icon blue-tinted or yellow-tinted?
yellow-tint -> iOS, watchOS, tvOS
blue-tint -> macOS

Resources