Setting up Airbrake with a Swift Project - ios

I'm new to Airbrake and I'm probably just doing something silly, but I've followed the steps outlined here to setup Airbrake in a Swift project: https://github.com/airbrake/airbrake-ios
Seems simple enough but I'm getting two errors I can't resolve:
1)
Use of unresolved identifier 'ABNotifier'
2)
Use of unresolved identifier 'ABNotifierAutomaticEngironment'
I removed all the files, frameworks and directories and tried again in case that was the issue but same errors occur. I'm guessing for some reason this ABNotifier class isn't being recognized/not in scope?
I'm wondering if others have had this problem and this is an easy fix. Below is my line throwing the error:
let key = "123456789"
ABNotifier.startNotifierWithAPIKey(key, environmentName: ABNotifierAutomaticEnvironment, useSSL: true, delegate: self)
Any ideas?

To fix this error you mentioned in the comment...
error: "This project uses features only available in iOS 4.0 and
later" in their file: GCAlertView.h
I ended up removing this line of code in GCAlertView.h in Airbrake. And it compiles fine. There's already minimum iOS version specified in the app bundle that prevents app installation. So I'd say checking this is pointless anyway.
#import <TargetConditionals.h>
#if TARGET_OS_IPHONE
//#ifndef __IPHONE_4_0 // hlung: this is not working correctly, remove for now
//#error This project uses features only available in iOS 4.0 and later
//#endif
#import <UIKit/UIKit.h>

Related

Use of undeclared type 'PKCS7' (Receipt-Validation/OpenSSL)

To set up Receipt-Validation in my iOS app, I am now following this tutorial:
https://www.raywenderlich.com/9257-in-app-purchases-receipt-validation-tutorial
and reading at this point: Loading the Receipt.
While reading and attempting to understand what is going on I also try to integrate the code in my own app, by doing so getting a hands-on understanding of the process.
Here is one problem I am hitting at this moment:
On this line of code:
private func loadReceipt() -> UnsafeMutablePointer<PKCS7>? {
I get this error message:
Use of undeclared type 'PKCS7'
After searching the net and trying a few things, I guess it is related to the use of the use of the ReceiptVerifier-Bridging-Header.h file. But I am not sure how to set it in the project.
I will be glad if anyone has some tip allowing me to move forward.
Thanks in advance!
In case this can be useful, here is the meaningful contents of the bridging header file (ReceiptVerifier-Bridging-Header.h):
#import <openssl/pkcs7.h>
#import <openssl/objects.h>
#import <openssl/evp.h>
#import <openssl/ssl.h>
#import <openssl/asn1_locl.h>
The problem is that I had simply copied the bridge-header file, without doing the proper setting as explained here:
https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift

Use of undeclared type 'XCTestCaseEntry'

Hi I can't seem to figure out why I am Use of undeclared type 'XCTestCaseEntry'
when using the following code in my .xctest:
import XCTest
#if !os(macOS)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(TrakkproTests.allTests),
]
}
#endif
I just ran into the same issue while attempting to run unit tests for a custom framework I've built using the Swift Package Manager.
It turned out I had accidentally selected an iOS simulator in the Xcode scheme/device selector:
This compiled the code for iOS which satisfies the compilation condition of !os(macOS) and causes the error to occur. XCTestCaseEntry appears to be part of the swift-corelibs-xctest project which provides XCTest functionality to non-Apple platforms (i.e. linux) but is not the same implementation Apple uses... I think.
The solution for me was to select "My Mac" in the scheme/device selector:
looks like the typealias XCTestCaseEntry is added as part of the commit https://github.com/apple/swift-corelibs-xctest/commit/1c7fb283231ce53960a232aa7c771bb2d38dee62 on oct 2017.
I don't think the XCTestCase class as part of the XCode/XCTest has this change yet. Where are you checking this anyway ?

UnityEditor.BuildPlayerWindow+BuildMethodException: when building Unity project for iOS

I am using Unity 2017.1.Op4 and I keep getting the following error when building the project for iOS:
UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:162
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:83
UnityEditor.HostView:OnGUI()
The build folder is also empty.
After making a Google search, a few recommended that I change the Product Name in the Player Settings.
Another workaround suggested: Clearing all errors and switching inspector to show Camera's components (it doesn't matter as long as it is not Player Settings window).
Both suggestions didn't work. How can I resolve this issue?
I just had this problem and solved. I hope this helps the next person with this problem.
My code contained wrong code like here:
#if UNITY_STANDALONE_WIN || UNITY_EDITOR
Correct Code Hear
#elif UNITY_ANDROID || UNITY_IPHONE
Compiled Error Code Hear
#else
#endif

'PushmoteSDK/Headers/Pushmote.h' file not found when trying to use pushmote sdk

I am trying to follow the steps given here:
http://docs.pushmote.com/docs/import-pushmote-ios-sdk-swift
but I am getting this error: 'PushmoteSDK/Headers/Pushmote.h' file not found, when I try and build my app.
Its my Pushmote-Bridging-Header.h file that has this import statement and the file is clearly there, in project_dir/PushmoteSDK.framework/Headers/Pushmote.h
I have read about a few other header file not found error with xcode and the solutions seem to vary a lot, so I think it might have to do with the specific version of xcode. Perhaps someone has used pushmote with xcode7 before and can assist?
EDIT:
This is my Pushmote-Bridging-Header.h file found in /Users/alex/ios_projects/Monkey/Monkey/Pushmote-Bridging-Header.h
#ifndef Pushmote_Bridging_Header_h
#define Pushmote_Bridging_Header_h
#import "PushmoteSDK/Pushmote.h"
#endif /* Pushmote_Bridging_Header_h */
You should change import line like this;
#import "PushmoteSDK/Headers/Pushmote.h"
to
#import "PushmoteSDK/Pushmote.h"

Getting "Expected a type" error in XCode

I'm getting this error:
/Class/GData/OAuth/GDataOAuthViewControllerTouch.m:116:22: Expected a type
That line is:
authentication:(GDataOAuthAuthentication *)auth
Inside of this block of code:
- (id)initWithScope:(NSString *)scope
language:(NSString *)language
requestTokenURL:(NSURL *)requestURL
authorizeTokenURL:(NSURL *)authorizeURL
accessTokenURL:(NSURL *)accessURL
authentication:(GDataOAuthAuthentication *)auth
appServiceName:(NSString *)keychainAppServiceName
delegate:(id)delegate
finishedSelector:(SEL)finishedSelector {
NSString *nibName = [[self class] authNibName];
I'm a newb XCode developer. So far I've created and compiled a calculator app based from an online class but that's it.
Is this a library that is not being included?
Background: The previous developer abandoned the project and the owner sent the project code to me. I'm trying to replace the existing graphics with new graphics and recompile it with support for iOS 6, which I thought I should be able to do without any coding, but have run into this error and many others when I opened the project. I have the latest XCode.
The :22 (and the position of the caret within the editor) tell you exactly where on the line the error is. In this case it's telling you that where it sees GDataOAuthAuthentication it was expecting a type. So, implicitly, it doesn't recognise that GDataOAuthAuthentication is a type.
Objective-C still sits upon compilation units ala C — each .m file is compiled in isolation then the lot are linked together. You use #import (or #include if you want; #import just guarantees the same file won't be included twice) to give each individual file visible sight of any external definitions it needs.
So, that's a long-winded way of reaching the same conclusion as Rick did five minutes ago: you've probably omitted a necessary #import.
A few things to look for:
Did you #import the file where the GDataOAuthAuthentication type is defined? (e.g. #import "GDataOAuthAuthentication.h")
Is there a variable named GDataOAuthAuthentication which is causing the compiler to think GDataOAuthAuthentication is a variable not a type?

Resources