Adding ShareKit to existing iPad app gives strange syntax errors - ios

I am trying to add ShareKit support to an existing iPad App. I got ShareKit code from http://getsharekit.com/. I added the ShareKit folder to the App per instructions and compiled it. Now I get syntax errors on previously working statements such as:
Statement in Constants.h file:
extern NSString * const kSupportURL;
Error:
Unknown type name 'NSString'
If I remove the ShareKit files it compiles and runs without any errors.
The project is being compiled under Xcode 4.2. Base SDK is "Latest iOS (iOS 5.0)". Target iOS Deployment target is "iOS 3.2". C Language Dialect is "C99 [-std=C99]"

Don't know how you linked your frameworks, but that particular message would appear if you weren't linked to Foundation.framework or if you forgot to #import foundation

Related

Attempting to use the forward class 'EKCalendarItem' as superclass of 'EKEvent' when building to device

I have an iOS project that uses React Native and the React Native Calendar Reminders native module. When in Xcode and building to the simulator everything works fine. When changing it to build to "Generic iOS Device" I get the following error:
While building module 'EventKit' imported from .../RNCalendarReminders.m:3:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/EventKit.framework/Headers/EventKit.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/EventKit.framework/Headers/EKEvent.h:37:22: error: attempting to use the forward class 'EKCalendarItem' as superclass of 'EKEvent'
#interface EKEvent : EKCalendarItem {
~~~~~~~~~~~~~~~~~~ ^
RNCalendarReminders.m line 3 is:
#import <EventKit/EventKit.h>
And I verified that in the Target's Build Phases it links with EventKit.framework library.
Xcode version: 8.2.1 (8C1002)
I resolved this issue myself. I'm not sure how but /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/EventKit.framework/Headers/EKCalendarItem.h was an empty file. I may have accidentally cleared it out when looking at in Xcode at some point.
I re-downloaded Xcode and it resolved the issue.
The reason this worked fine when building on the simulator is because in that case EventKit.framework is a binary read from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/EventKit.framework.

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)).

Which compiler settings are changed when I change target device?

I have an iOS project that builds fine for simulators, but which has compiler errors when built for a Generic Device or when I try to run on a real device through Xcode. NOTE: actual compiler errors, not linker or deployment errors. The errors are to do with mismatched types in typedefs - as if it's including headers from a different SDK, or has different preprocessor defines.
My question is - what compiler settings are changed when I change target device in the Xcode UI and where can I view the differences? I cannot see any differences when I look at the project settings and change the target device - specifically the deployment target version and SDK version appear unchanged.
The project used to build fine with any of these target devices under Xcode 7, but does not under Xcode 8. I suspect this is down to the version of the SDK that comes with Xcode. But for it to work with some target devices and not others it has to be changing compiler settings. This should be really simple to fix, if only I could see what changes it's making!
Here's the line (in my code) which fails to compile:
typedef void* IOSurfaceRef;
And here's the error message:
error: typedef redefinition with different types ('void *' vs 'struct __IOSurface *')
Please note I don't want help fixing the error or advice on what it's trying to do - I know it's not good. I'd just like to know which compiler settings are changed by switching target device.
It fails because CGBase.h contains this code:
#if !TARGET_IPHONE_SIMULATOR
typedef struct CF_BRIDGED_TYPE(id) __IOSurface *IOSurfaceRef __attribute__((swift_name("IOSurfaceRef")));
#endif
When you are building for a device the #if !TARGET_IPHONE_SIMULATOR preprocessor directive is true, so your code has two typedefs for IOSurfaceRef with conflicting types.

'FBSDKLoginKit/FBSDKLoginKit.h' file not found (Facebook SDK for iOS v4.2 & Xcode 7)

I follow all the steps in This Tutorial and/or Facebook SDK Documentation to install Facebook Login on my App, but when I run the code I get an error. although Facebook mention I can just use import (Swift) to include the framework, I try to do it the old fashion as well with Objective-C Bridge Header.
Error:
'FBSDKLoginKit/FBSDKLoginKit.h' file not found
ScreenshotAs you can see the bridge.h is being read by the compiler, but due to internal file error it will throw error.
Bridge.h In Xcode 6 you don't require bridge header file, I could just do it with import
#import <FBSDKLoginKit/FBSDKLoginKit.h>
This problem is due to Xcode 7 Beta, I have tried to do it on Xcode 6 and it worked perfectly with just an import FBSDKLoginKit. Can anyone tell me a hack around this? or if there is a way to convert my Swift 2 code back to 1.4 and work on Xcode 6.
I had the same problem.
Managed to sort the directory by adding the Facebook SDK in "Framework Search Path".
Target -> Build Settings -> Framework Search Paths -> + /Users//Documents/FacebookSDK
it works!
=]
For those using cocoapods the solution for me was actually adding FBSDKCoreKit to podfile:
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
The facebook documentation is incomplete, they dont mention anything about including FBSDKCoreKit pod reference.
For [login,sharekit,corekit].h file not found error , My solution was:
changing framework searchpath of RCTFBSDK (inside library of the project)
~/Documents/FacebookSDK
to
$(HOME)/Documents/FacebookSDK
I have the same issue and recognized, that my old XCode 6 projects worked with the Facebook frameworks.
So i try the following workaround and that fixed the problem. however i don't know why:
Facebook iOS SDK 4.2
Create a fresh project in XCode 6
Link the Facebook Frameworks to your project as described in the docs
Close the project and reopen it in XCode 7
The "To Swift 2 Converter" should open within the project - Convert the project to Swift 2
Run the project - in my case everything works fine.
After that i copied my "old" Swift 2 Files into the new project. The app starts without any issues.
I observed the changes by the converter, but can't recognized any change depending the Facebook frameworks.
Had the same issue, instead of updating the search path
I solved it by removing the Frameworks from the project and then adding them checking the Copy items if needed box
My header files looks this
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
You can simply put ~/Documents/FacebookSDK in Framework Search Paths and it will work for any user
this is a known bug: https://developers.facebook.com/bugs/362995353893156/
Check out this solution: Facebook iOS8 SDK build module error for FBSDKCoreKit

build error on iOS 7.1 - Zxing

Updated to XCODE 5.1/IOS 7.1 and tried to build my project which included Zxing library.
Getting the following error:
/Zxing/cpp/core/src/zxing/ChecksumException.h:3:9: '__CHECKSUM_EXCEPTION_H__' is used as a header guard here, followed by #define of a different macro
Error is occurring for the following code,
#ifndef __CHECKSUM_EXCEPTION_H__ //this line causes the error.
#define __NOT_FOUND_EXCEPTION_H__
.....
.....
#endif // __CHECKSUM_EXCEPTION_H__
Everything was perfect before the xcode 5.1 update.
I suspect recent migration of IOS 7.1 to support 64-bit architecture causes this error but i'm not sure.
I tried to remove 64-bit support from the Zxing library using this link but still it's not working.
Any help or suggestion would be greatly appreciated.
Looks like there are some underground compiler settings changes in XCode 5.1.
So to fix this issue you need add -w flag to ZXingWidget Other Warning Flags.
This flag completely disable all compiler warnings.
Select ZXingWidget framework.
Select ZXingWidget target in ZXingWidget framework.
Press Build setting tab and type "other wa" in search.
Add -w parameter flag to Other Warning Flags.
Here is a screen with steps how to add this flag:

Resources