IM trying to use onesignal with react native. I linked everything on android and ios. Everything is working fine on ios but I get undefined is not an object (evaluating RNOneSignal.configure).
and I just added this line: OneSignal.configure({});
on the AppDelegate.m put the #synthesize oneSignal = _oneSignal; statement between the #implementation block and the #end block. I was putting it after #end and I was having the same problem. Hope it helps.
I had the same issue. In my way the reason was this library was not linked correctly. Check this strings in file android/app/src/main/java/YOUR_APP_FOLDER/MainApplication.java:
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
before first method and
new ReactNativeOneSignalPackage()
inside "return Arrays.asList("
Related
I have an existing Objective-C app and have developed a SwiftUI iOS 14 Widget for it. So far so good. Now I am trying to reload the timeline from my Objective-C app. I understand that there are no Objective-C api for accessing WidgetCenter, so I have implemented the bridging steps outlined in Apple's documentation (at least I think I have since I am totally new to Swift). I cannot seem to be able to get Widget Center nor WidgetCenter.shared.reloadAllTimelines()recognized in my Objective-C app. I have tried many approaches with no success, so I must be doing something wrong. Any help or suggestions would be greatly appreciated.
I faced with the same issue. The solution for this was to create a swift file for example: WidgetKitHelper. Create the assigned swift-objc header with that too (bridging header file) if it not generated automatically you can add it by manually (search for it).
In the helper object you can get access to widgetkit, and if you do the rest to be able to see the swift code from your objc code, you can use this as a wrapper.
Tips:
import WidgetKit
#available(iOS 14.0, *)
#objcMembers final class WidgetKitHelper: NSObject {
class func reloadAllWidgets(){
#if arch(arm64) || arch(i386) || arch(x86_64)
WidgetCenter.shared.reloadAllTimelines()
#endif
}
}
obj-c code:
First import the swift code by adding:
#import "YourProjectName-Swift.h"
Then you can use:
[WidgetKitHelper reloadAllWidgets];
react native library in android can use "getCurrentActivity()" to replace "this"
final Activity activity = getCurrentActivity();
And In ios How can use to replace "self" to get current UIViewController
For "current UIViewController" you most probably needs RCTPresentedViewController function from RCTUtils.h file:
#import <React/RCTUtils.h>
// ...
UIViewController* vc = RCTPresentedViewController();
// ...
Note: Very old RN versions do not has this API, but it can be easy implemented by hands, implementation is easy enough: RCTUtils.m
On iOS - unless you use wix's react native navigation - there is generally only one UIViewController, instantiated in your AppDelegate.
1st question: Why do you need your app UIViewController ?
if you really need to access it, here is a suggestion : UIApplication.sharedApplication().window.rootViewController (this code might not work for complex native setup, but for simple cases, it should give you your app ViewController)
I am trying to define methods for user login in my IOS app with Google+. I would like to do this in separate utility class rather than view controller (because I will expose these components to native react.js later).
My class header will look like following:
#interface LoginUtility : NSObject<GPPSignInDelegate>
+ (void)googleLogin
However, "GPPSignInDelegate" does not work inside NSObject class. After I implement like that, I start getting linker error like:
"_OBJC_CLASS_$_CMMotionManager", referenced from: objc-class-ref in GooglePlus(GPPSpamSignal.o)".
Note: I added all dependency libraries.
When I put the same code in ViewController, it just works fine. I also tried same logic with Facebook login and it worked perfectly.
Why is Google enforcing sign in method to be called inside ViewController?
Are there any ways to solve this problem?
Thanks in advance!
CMMotionManager is part of the CoreMotion framework. You obviously haven't linked that in correctly.
Ive been trying to get my app working with parse and i cannot get the test to work. I think it might be due to viewcontroller.m not recognising "PFObject". I need to add this into the view controller as the instructions say on parse.com but i cannot get it to work.
Has anyone had this problem or have any ideas?
Thanks!
Have you done #import <Parse/Parse.h> at the top of your view controller.m?
I downloaded this sample: https://developer.apple.com/library/ios/#samplecode/Touches/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007435
If I start the sample app everything is working fine.
I made my own app and copied most of the code into it. There is a method called adjustAnchorPointForGestureRecognizer: But in this method there is a error but only in my app (see screenshot): "Property anchorPoint cannot be found in forwar class object CALayer". I am wondering how I can solve this issue, I don't know what I did wrong. It is exactly the same code from the sample. Anyone can help? Thanks!
Did you import the QuartzCore framework into your project? Maybe that's why it can find the CALayer class
This error is thrown by XCode when it can't find a definition for CALayer. You should add the framework to your project and add #import <QuartzCore/QuartzCore.h> to wherever you are using the class