OneSignal integration in iOS 8.0 Swift - ios

I tried to integrate onesignal push library with my iOS app by followng their tutorial(https://documentation.onesignal.com/docs/ios-sdk-setup). However after adding OneSignal pod using cocoapods I'm getting following error
/Pods/IQKeyboardManagerSwift/IQKeyboardManagerSwift/IQKeyboardManager.swift:514:35:
'shared' is unavailable: Use view controller based solutions where
appropriate instead.
IQKeyboardManagerSwift is another pod added using cocoapods.
I tried various solutions mentioned in Stackoverflow but nothing worked. Is there anyway to fix this issue permanently?

Skip the 1st step (1. Add Notification Service Extension) in the tutorial. Then it will run without any issue.

Related

How to integrate ObjectiveC framework (IronSource) into Flutter (iOS Swift)?

I'm trying to integrate IronSource SDK in a iOS Flutter project (Swift project), but I am unable to do that. According to the IronSource documentation, I must point to IronSource.h file to include the bridge I need. And I am able to implement it in normal Xcode swift project, but I am unable to do that in flutter project since this bridge is already used by the flutter and it can be only one file.
So the question is: How can I integrate another ObjC library (IronSource) in the existing flutter ios project?
I am new to iOS development and Im battleing this for about a week now. I cant find anything on the internet that would work so any help will be much appreciated. Thanks
I managed to resolve my issue. It turns out that build paths are not case sensitive and I was using 'ironsource' for my plugin name but IronSourceSDK is using 'IronSource' so it looks like at build time it did not find the correct files.
And when this was working, I had to add 'use_frameworks! :linkage => :static' in the pod file of the plugin.
Then I could depend on it in my swift flutter app normally as any other plugin.

FBSDKcorekit shared application is unavailable

I am using Pod and all are the lastest version
Using
Pod onesignal
Pod facebook login
Target ‘onesignalnotificationextention’do
Pod ‘onesignal’
end
Onesignal is an notification service extension
Facebooklogin is working when onesignal are removed
But it give this error when both are used
‘sharedapplication’ is unavailable:not available on ios(app extension) -use view controller based solutions where appropriate
How to solve this?
Error in code
This is in FBSDKAppEvent.m
Uiviewcontrollwr *vc =[uiapplication sharedApplication].keyWindow.rootViewcontroller.presentedViewcontroller;
please help, i can't find anything?
so i solved this problem
the problem was that i only
set
require only App-Extension-Safe Api to no
in myproject.xcodeproe and the targets
it seemed the all the facebook pods were to yes
so i have to set no for all xcodeproject,target,all facebook pods
you can find require only App-Extension-Safe Api
in build setting for pods,target,and project
important note when ever you reinstall pods they are reseted to yes

Push notification with OneSignal: What means "No Push Token"?

I'm using OneSignal for push notifications.
In the subscribed list some devices/users are marked with No (No Push Token). Explanation says: This user has no push token and cannot be targeted.
That occurs for iOS devices as well as for Android devices.
What does it mean? Why does it happen? How to change it?
This means OneSignal did not get a pushToken from the device however the device was able to register with your OneSignal account. On iOS the pushToken is known as the device token, on Android this is the Google registration id.
Depending on the OneSignal SDK you're using there is a setLogLevel function that can be called before you call OneSignal init to add additional logging. This will be printed in the Xcode log for iOS or adb logcat for Android. Also make sure you are using the last OneSignal SDK.
You can also contact OneSignal through the help bubble on the bottom of the page while logged in and they can check your account to help diagnose the issue.
Could you check if the "Push Notifications" capability is turned on? If it is not, turn it on and see if it works, otherwise keep reading.
Make sure you're running the latest version of the OneSignal SDK (2.1.14)
as this version should have resolved the issue. Next, try the following fixes:
Fix 1
From the navigation panel, select your top blue project. Then select your target and navigate to the Build Settings. Search for other linker flags and add the following entry: -ObjC
Do a project clean and run again, see if it works.
Fix 2
In your bridging header (if you have one), or on any header file that is visible to your App Delegate, create an extension for OneSignal class in which you define the following interface method:
+ (void)didRegisterForRemoteNotifications:(UIApplication*)app deviceToken:(NSData*)inDeviceToken;
Next, override the didRegisterForRemoteNotifications delegate method in your app delegate and call the above method on OneSignal and pass both parameters to the SDK.
Note that there was a pretty significant flaw in the OneSignal SDK when used in XCode 8 up to version 2.1.10 that resulted in these No push token registrations for iOS devices when including the package using Cocoapods (the recommended approach). Make sure you update your pod.
See the release notes for 2.1.11:
Fixed a 'No Push Token' issue in 2.1.10 that would happen when OneSignal was downloaded through CocoaPods and included other pods that used the -ObjC flag.
Make sure that your Xcode project has "Push Notifications" and "Remote notifications" enabled.
As other answer mentioned, there is a bug in 2.1.10 for CocoaPods setup. So I changed
from
pod 'OneSignal' ## points to 2.1.10
to
pod 'OneSignal', :git => 'https://github.com/OneSignal/OneSignal-iOS-SDK.git', :branch => 'master'

Why am I getting 'Braintree/BTUICTAControl.h' file not found error on Braintree manual integration?

I get the following build error after implementing step number four "Add the Braintree SDK code to project" from the Manual Integration Without CocoaPods guide.
braintree_ios/Braintree/UI/Braintree-Payments-UI.h:3:9: 'Braintree/BTUICTAControl.h' file not found
Tested in
New Objective-C iOS app project.
In Xcode 6.1 (6A1042b) and 6.3 (6D543q)
How can I fix this build error?
I work on the Braintree iOS SDK.
I believe using the name Braintree instead of Braintree SDK for the framework target name will resolve this particular issue. I recently updated the manual docs accordingly.
We recommend that you integrate using CocoaPods if at all possible, as it handles all this complexity for you.
Note also that I've responded on the issue you posted on GitHub. Let's resolve this there. Thanks!
Have you tried manually downloading the zip file and not using git?
Try following the second bullet point from the first step.

iOS Afnetworking 2.0 AfSecurityPolicy.m showing an error while building the project

I am following a tutorial at http://www.raywenderlich.com/30445/afnetworking-crash-course for iOS AfNetworking. The tutorial follows the old version of AfNetworking, but I have managed to migrate it to the new AfNetworking (2.0). After following the JSON request I had no error. As soon as I hit the run button to run the app, I get the following error due to AFSecurityPolicy.m at two places.
"No visible #interface for 'NSArray' declares the selector 'firstObject'".
Here is a screenshot of the error:
Initially, the security framework was not included, so I included it in case the error was due to that. But, after adding SecurityFramework the error is still there.
Now I am kind of lost since I searched the web and didn't find any problem similar to this. Any help would be appreciated.
Thank you
[NSArray -firstObject] is new to iOS 7, your target architecture is probably set too old. AFNetworking 2.0 only supports iOS 6 and iOS 7.
From The Question It Seems that you Been using OSX foundation.framework rather that ios cocoa touch Foundation.framework
As in Osx console apps the NSArray dont have the property of first Object
you can use the
array[0] for the instance if error still persist better switch to ios sdk for further use.
Thanks
In order to get your old code running you need to use AFNetworking old version pod, that used to work properly.
For that you need to edit in your "Podfile" in TextEditor
change " pod 'AFNetworking' " to " pod 'AFNetworking','~> 1.3.1' " (you need to use your verison of AFNetworking that was working fine)
Then run "pod update" on terminal

Resources