I am getting:
Use of undeclared Identifier GMSServices
error when using Google Maps IOS SDK. Below is the code in AppDelegate.m:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
googleMapsApiKey = #"AIzaSyB2x3fulSTaAE6F6sHgnLEHXpGt";
[GMSServices provideAPIKey:googleMapsApiKey];
}
I have added the GoogleMaps.framework and GoogleMaps.bundle to the project Frameworks folder (Google Maps 1.9.2 with Xcode 6.4).
I am using a mixed Objective-C and Swift project. My bridging header file contains
#import <googleMaps><googleMaps.h>
Under Targets and Build Settings, the Objective-C Bridging Header is showing the correct path.
I have refreshed my server and IOS keys to no avail.
Related
I am a Unity game developer and know very little about app side code, so forgive me if I'm doing something stupid.
I'm trying to set up Firebase to work in my Unity iOS app. I'm in the very first setup, trying to get the SDK working.
So Firebase has you do a couple steps, and then they want you to do some initialization in your App Delegate. They want you to add two lines, an import and a configure. This is the code from their setup section.
#import UIKit;
#import Firebase;
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure];
return YES;
}
So Unity doesn't actually use a traditional AppDelegate. I went sleuthing and found this guy's work. He basically shows how to use a standard Unity Plugin to override the app delegate. So I put the following code in my Plugins folder.
#import "UnityAppController.h"
#import Firebase;
#interface OverrideAppDelegate : UnityAppController
#end
IMPL_APP_CONTROLLER_SUBCLASS(OverrideAppDelegate)
#implementation OverrideAppDelegate
-(BOOL)application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) options
{
NSLog(#"[OverrideAppDelegate application:%# didFinishLaunchingWithOptions:%#]", application, options);
[FIRApp configure];
return [super application:application didFinishLaunchingWithOptions:options];
}
#end
Now. I'm pretty sure the Plugin is working because I can find it in my XCode project, and when I was screwing around with it and had two instances of [FIRApp configure]; it actually crashed with an error basically saying, "don't configure twice". But Firebase has not received anything from my app. They have a little prompt that says, "Checking if the app has communicated with our servers. You may need to uninstall and reinstall your app." I've uninstalled, reinstalled, tried their whole installation process again, and still nothing.
Any thoughts?? Thanks ahead of time.
If you're developing an app in Unity you can use the Firebase for Unity plugin rather than implementing your own iOS solution. Try adding Analytics to your app with this guide.
I am building a plugin to integrate an external framework to an Cordova, following the documentation, I need to include a new delegate to AppDelegate.h of my app.
If was developing a native application, i just need to import the file and include the delegate on it.
#import <MySpinServerSDK/MySpinServerSDK.h>
#interface AppDelegate : UIResponder <UIApplicationDelegate, MySpinServerSDKDelegate>
How can I add a extra delegate to a Cordova App for iOS using the plugin structure?
I did all the preparation in a plugin (external frameworks an plist configuration) but not sure if its possible to create this kind of integration using cordova plugins.
You can reference these Cordova Plugins as examples: App-Event or Deep Links
Note how the App Event developer named the new files with a plus sign: AppDelegate+APPAppEvent.h and AppDelegate+APPAppEvent.m in his Cordova plugin. In the header file, the developer used a category "APPAppEvent" while declaring his new class as an AppDelegate:
#interface AppDelegate (APPAppEvent)
#end
The Deep Links developer did the same:
#interface AppDelegate (CULPlugin)
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler;
#end
I am trying to add Firebase to my Codename One iOS app.
I've read up on how to add Native Interfaces in Codename One and have successfully added the CocoaPods for Firebase as well. However, being unfamiliar with Objective-C and iOS in general (I've never worked on an iOS app outside of the Codename One framework), I'm not sure how to integrate these instructions from the Firebase website into my interface:
#import UIKit;
#import Firebase;
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure];
return YES;
}
As well as the instructions here: https://firebase.google.com/docs/analytics/ios/start?authuser=0,
specifically:
Import the Firebase module in your UIApplicationDelegate subclass:
OBJECTIVE-C
#import Firebase;
Configure a FirebaseApp shared instance, typically in your application's application:didFinishLaunchingWithOptions: method:
OBJECTIVE-C
// Use Firebase library to configure APIs
[FIRApp configure];
I added the .plist file to my native -> ios folder.
EDIT: I want to use the following Firebase features: analytics and crash reporting to start with, eventually notifications.
Can someone advise how this would be done?
Thanks!
Add the build hints:
ios.afterFinishLaunching=[FIRApp configure];
ios.glAppDelegateHeader=#import <Firebase/Firebase.h>
The rest of the things you can just invoke in the native interface code. Notice the tip to wrap the code in async blocks https://www.codenameone.com/blog/tip-use-native-edt.html
I am trying to use the Intercom iOS SDK in a Swift app that I am building. However, all their documentation is written in Objective-C. As I am just starting out I am not quite sure how to implement Intercom in my application.
I've added "pod 'Intercom'" to my Podfile and added the import statement to my bridging header.
The next step in setting up intercom in an iOS app is initializing it in my applications AppDelegate with the following code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Initialize Intercom
[Intercom setApiKey:#"<#ios_sdk-...#>" forAppId:#"<#your-app-id#>"];
}
And then using objective-c code in my swift view-controller like so:
- (void)successfulLogin {
...
// Registering with Intercom is easy. For best results, use a unique user_id if you have one.
[Intercom registerUserWithUserId:#"<#123456#>"];
}
How do I implement Objective-c code like this in my swift project?
I've searched around, as well as contacted Intercom's support, but am yet to find an answer.
Many thanks!
[Intercom setApiKey:#"<#ios_sdk-...#>" forAppId:#"<#your-app-id#>"];
becomes
Intercom.setApiKey("<#ios_sdk-...#>", forAppId:"<#your-app-id#>")
and
[Intercom registerUserWithUserId:#"<#123456#>"];
becomes
Intercom.registerUserWithUserId("<#123456#>")
I would suggest to look over Swift tutorials to see the syntax and learn how to migrate Objective-C code to Swift code properly.
I tried to integrate Fabric in iOS project. I followed the steps from the tutorial:
Add a run script Build Phase
In AppDelegate.m
Implementation:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[Fabric with:#[CrashlyticsKit]];
return YES;
}
Run project
However at last check application crashes:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Kit info missing for Crashlytics kit'
What is wrong?
You probably already imported these files, but for future readers, you should also have in AppDelegate.m:
#import <Fabric/Fabric.h>
#import <Crashlytics/Crashlytics.h>
You should also have Fabric.framework and Crashlytics.framework in your Frameworks (project -> target -> link phases -> link binary with libraries).
You should also have Fabric RunScript in Link Phases:
./app/path/Fabric.framework/run key1 key2
If you followed Fabric.app tutorial, you should have all these steps configured. Did you follow it? Fo you have all above items?