Coder Social home page Coder Social logo

swrve-ios-sdk's Introduction

CircleCI

What is Swrve

Swrve is a single integrated platform delivering everything you need to drive mobile engagement and create valuable consumer relationships on mobile.
This native iOS SDK will enable your app to use all of these features.

Getting started

Have a look at the quick integration guide at http://docs.swrve.com/developer-documentation/integration/ios/

Installing using CocoaPods

Add the following line to your Podfile

pod ‘SwrveSDK’

Installing using Carthage (iOS 8+)

You can use Carthage to install Swrve by adding it to your Cartfile Note SwrveSDK version > 8.0 depends on SDWebImage. SDWebImage.xcframework is included in the root of our SwrveFramework project. Use this or add SDWebImage to your cartflie as shown below.

github "Swrve/swrve-ios-sdk"
github "SDWebImage" "~> 5.0"

Installing using Swift Package Manager (Xcode 12+)

For installing Swift packages, please see the [Apple Developer Docs](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app Requirements)

Requirements

Xcode (latest)

The SDK supports iOS 10+ and the latest version of Xcode (Xcode 10.1, as the time of writing). The SDK will handle older versions of the OS with a dummy SDK.

Sample Projects

  • The samples folder contains several sample projects that include integration instructions and demonstrate best practices.
  • Replace the -1 and <API_key> arguments found in the project's AppDelegate file with the AppID with the API Key provided by Swrve.
  • Run on your device or on the emulator.

Contributing

We would love to see your contributions! Follow these steps:

  1. Fork this repository.
  2. Create a branch (git checkout -b my_awesome_feature)
  3. Commit your changes (git commit -m "Awesome feature")
  4. Push to the branch (git push origin my_awesome_feature)
  5. Open a Pull Request.

License

© Copyright Swrve Mobile Inc or its licensors. Distributed under the Apache 2.0 License.

swrve-ios-sdk's People

Contributors

bejo avatar bf-sharris avatar brendanwhelanmg avatar danhollywells avatar deepakshuklatmg avatar dominicmarmionswrve avatar frizlab avatar kevbrodigan avatar kgellci avatar oisin avatar seaders avatar tiescoo avatar vinceburn avatar wendyverbruggen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swrve-ios-sdk's Issues

Payloads of events not visible in Swrve Console

This is an example of json body that is sent to https://<app_id>.api.swrve.com/1/batch
{"user":"XXX","short_device_id":18003,"app_version":"1.0","session_token":"XXX","data":[{"payload":{"screen_name":"settings","button_name":"share"},"seqnum":1728,"name":"appname.top_level.press_button","type":"event","time":1520010244863}],"version":2}
I see this when I debug network requests in the app.

Events are recorded and visible in Swrve console but payloads are missing.
screen shot 2018-03-02 at 18 25 16

UIApplication sharedApplication in app extension

#if !(defined(__has_feature) && __has_feature(attribute_availability_app_extension)) is not the proper way to check if the code is running in an app extension. https://stackoverflow.com/questions/24018380/what-is-the-preprocessor-macro-to-test-whether-an-application-extension-is-being#comment48827623_29076070

See how SDWebImage handles this issue by checking if UIApplication responds to the selector sharedApplication. https://github.com/rs/SDWebImage/blob/2f892f968fe03e82f468adf9df20fd6b06254aea/SDWebImage/SDWebImageDownloaderOperation.m#L129-L144

Strong Retain causing Memory leak!

Setting delegate is causing Memory leak.

@property (nonatomic, retain) id <SwrveMessageDelegate> showMessageDelegate; /*!< Implement this delegate to intercept in-app messages. */

Push Permission Request When Not Desired

Push token can be requested for silent push notifications. Silent push notifications don't require user permission. This code automatically asks a user for push permission despite it not always being the desired case. This code should simply call "registerForRemoteNotifications" instead of going through the entire requesting push permissions flow.

NSData* device_token = [SwrveLocalStorage deviceToken];
if (self.pushEnabled && device_token) {
// Once we have a device token, ask for it every time as it may change under certain circumstances
[self.analyticsSDK.push registerForPushNotifications];
}

Unknown push notifications enabled

We realize that in the newer version of one app that we are using Swrve services, user are always sending that their push notifications are unknown.
I just debug the code and I realize that although:
pushSettingsEnabled = [app isRegisteredForRemoteNotifications];
it is YES we are returning the unknown state.
I think the problem could be in this last commit.
09b368d
Thank you for your attention.

[Question] Migrating from UIWebView to WKWebView

From the docs:

Starting in iOS 8.0 and OS X 10.10, use WKWebView to add web content to your app. Do not use UIWebView or WebView.

Are there any plans to migrate to using WKWebView instead of UIWebView within the framework? I haven't yet checked how big this task would be, but if other things have higher priority I can try to find some time to help out.

Thanks!

+[SwrvePermissions updatePermissionsStatusCache:] crash

I'm getting EXC_BAD_ACCESS KERN_INVALID_ADDRESS crashes on +[SwrvePermissions updatePermissionsStatusCache:]. I believe that although adding entries to the dictionary is thread-safe via @synchonized, the way the dictionary is created isn't thread-safe.

+ (void)updatePermissionsStatusCache:(NSMutableDictionary *)permissionsStatus {
if (permissionsStatusCache == nil) {
permissionsStatusCache = [[NSMutableDictionary alloc] init];
}
@synchronized (permissionsStatusCache) {
[permissionsStatusCache addEntriesFromDictionary:permissionsStatus];
}
}

RootViewController doesn't handle `unrecognized selector` exception

Hey team,

We've recently launched an in-app message campaign at scale and we caught a lot of unrecognized selector exception for our used rootViewController.

image

When digging deeper, it seems coming around SwrveMessageViewController. I didn't see any usage in our main codebases but from what I read, the SDK tries to get the rootViewController and cast it in a specific type to display or dismiss the given message. That's I believe where the exception happens.

The crash happens specifically for users launching the app. I'm not sure if it's because the view isn't displayed yet, or if it's already dismissed, or in between state. It happens mostly for iOS13 but also for iOS12 devices.

The current version used is 6.3.0, I'm upgrading to 6.4.1 as well but I can see the potential failing code is still there.

SwrveInAppCampaign *dismissedCampaign = ((SwrveMessageViewController*)self.inAppMessageWindow.rootViewController).message.campaign;
[dismissedCampaign messageDismissed:now];

Thanks

Version 6.8.1 not building with SPM on Xcode 12.5

Current version 6.8.1 doesn't build with SPM on Xcode 12.5 the issue is with the Swrve.h umbrella header not importing public Obj-C headers that are placed (or symlinked) to SwrveSDK/include.

You'll need to add the below to Swrve.h at the bottom of the file. I would also recommend to remove +Private.h headers from the /include folder.

#if __has_include(<SwrveSDK/SwrveSDK.h>)

#import <SwrveSDK/SwrveButton.h>
#import <SwrveSDK/SwrveConversationCampaign.h>
#import <SwrveSDK/SwrveDeviceProperties.h>
#import <SwrveSDK/SwrveEmpty.h>
#import <SwrveSDK/SwrveEventQueueItem.h>
#import <SwrveSDK/SwrveEventsManager.h>
#import <SwrveSDK/SwrveInAppCampaign.h>
#import <SwrveSDK/SwrveImage.h>
#import <SwrveSDK/SwrveMigrationsManager.h>
#import <SwrveSDK/SwrvePersonalisedTextImage.h>
#import <SwrveSDK/SwrveProfileManager.h>
#import <SwrveSDK/SwrveSDK.h>
#import <SwrveSDK/SwrveTrigger.h>
#import <SwrveSDK/SwrveTriggerCondition.h>
#import <SwrveSDK/UISwrveButton.h>

#else

#import "SwrveButton.h"
#import "SwrveConversationCampaign.h"
#import "SwrveDeviceProperties.h"
#import "SwrveEmpty.h"
#import "SwrveEventQueueItem.h"
#import "SwrveEventsManager.h"
#import "SwrveInAppCampaign.h"
#import "SwrveImage.h"
#import "SwrveMigrationsManager.h"
#import "SwrvePersonalisedTextImage.h"
#import "SwrveProfileManager.h"
#import "SwrveSDK.h"
#import "SwrveTrigger.h"
#import "SwrveTriggerCondition.h"
#import "UISwrveButton.h"

#endif /** has_include **/

Control preferredStatusBarStyle

Some time ago you've added option to control status bar appearance with prefersIAMStatusBarHidden.
Is it possible to control status bar style?

[Request] SPM support

As for now, I didn't see any information regarding SPM support.
Do you plan to support SPM or is there any information regarding that?

Passing launch options loses rich push action identifier

When passing in launch options to SDK, it doesn't take into account the action identifier. So if a user taps on a rich push button and it launches the app, the user is not directed to the button's action but rather to the default action.

"checkLaunchOptionsForPushData:" calls the "remoteNotificationReceived:" received selector which doesn't take into account the action identifier. Swrve should check if UNUserNotificationCenter exists and if it is the delegate. If so, it should not call "checkLaunchOptionsForPushData:".

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = push;
}
if (swrveConfig.autoCollectDeviceToken) {
[self.push observeSwizzling];
}
if (swrveConfig.pushResponseDelegate != nil) {
[self.push setResponseDelegate:swrveConfig.pushResponseDelegate];
}
// Check if the launch options of the app has any push notification in it
if (launchOptions != nil) {
[self.push checkLaunchOptionsForPushData:launchOptions];
}

Can't upload app via Xcode 9 beta with Swrve

application-uploader-itunes-store-operation-failed

Although the error doesn't seem to have anything to do with Swrve, when I include Swrve in the app, I receive this error when attempting to upload the app to iTunes Connect via Xcode 9. When I exclude Swrve, the app is uploaded without error.

Control logging with a runtime flag

In almost Frameworks/SDKs, the log level can be configured at runtime rather than compile time with a compilation option.
Would you consider adding this option in the Swrve SDK?

Vulnerabilities caused by use of the Weak HASH API(s)

Hi,
We are using Version 6.1.0 in our project & since there is CC_MD5 present in code which is creating vulnerabilities in the code. So just wanted to know whether these banned API's are going to be resolved in upcoming versions.

We are looking forward to your support.
Thanks

Xcode 13 b4 - SwiftPackageManager App Extensions

Using latest version of SwrveSDK 7.0.3 and Xcode 13.0 beta 4 the App Extensions targets don't compile due:

'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.

and

'openURL:' is unavailable: not available on iOS (App Extension)

Crash with message "NSArray was mutated while being enumerated"

HI,

We have reported several crashes in Swrve SDK, the version in use is 6.4.0.

The stack trace of the crash is the following.

NSGenericException: *** Collection <__NSArrayM: 0x2836e5020> was mutated while being enumerated.

0  CoreFoundation    ___exceptionPreprocess
1  libobjc.A.dylib   _objc_exception_throw
2  CoreFoundation    ___NSFastEnumerationMutationHandler
3  SwrveSDK          -[Swrve queuePausedEventsArray]
4  SwrveSDK          -[Swrve switchUser:isFirstSession:]
5  SwrveSDK          -[Swrve identifyCachedUser:withCallback:]
6  SwrveSDK          __36-[Swrve identify:onSuccess:onError:]_block_invoke
7  libdispatch.dylib __dispatch_call_block_and_release
8  libdispatch.dylib __dispatch_client_callout
9  libdispatch.dylib __dispatch_main_queue_callback_4CF$VARIANT$armv81
10 CoreFoundation    ___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
11 CoreFoundation    ___CFRunLoopRun
12 CoreFoundation    _CFRunLoopRunSpecific
13 GraphicsServices  _GSEventRunModal
14 UIKitCore         _UIApplicationMain
15 VivoMovelBR       main (main.swift:35:5)
16 libdyld.dylib     _start

Here you can find the whole stack trace report.

Thanks

The resources for SwrveConversationSDK

I see two issues here that I'm wondering can be addressed. The first is that the images aren't in an xcasset which means that when this is packaged up every device will download every image in a given image set. The second is that there are no @3x images for the 6+ which is good just for completeness sake. I can write a PR for the xcasset, but I wanted to ask first if there is some reason that's not being done.

Crash on identification

  SwrveSDK causing crash with out any stack log, when I add following line of code on App it causes app crash. 

iOS Version: 12.3
Xcode Version: 10.2.1
Swift Version: 4.2

      //upload user id to swrve
      SwrveSDK.identify("1234", onSuccess: { (status, swrveUserId) in
            // Success, continue with your logic
        }) { (httpCode, errorMessage) in
            // Error should be handled
        }

Swrve 7.0.3 Raising issue with SwrveGeoSDK - Swift

I am using Swrve and SwrveGeoSDK in one of my library using pod. Yesterday I updated my pod and it updated my Swrve pod to 7.0.3 from 7.0.2. Now I am getting errors in my library as below:

**dyld: Symbol not found: _OBJC_CLASS_$_SwrveCommon**
  **Referenced from:** /Users/shahjahanrana/Library/Developer/CoreSimulator/Devices/102EB53D-F0E0-4905-B774-FAECBD3E3126/data/Containers/Bundle/Application/097F24EC-ECF7-4C79-979E-B25A2BF35073/SampleDemoApp.app/Frameworks/SwrveGeoSDK.framework/SwrveGeoSDK

  **Expected in:** /Users/shahjahanrana/Library/Developer/CoreSimulator/Devices/102EB53D-F0E0-4905-B774-FAECBD3E3126/data/Containers/Bundle/Application/097F24EC-ECF7-4C79-979E-B25A2BF35073/SampleDemoApp.app/Frameworks/SwrveSDK.framework/SwrveSDK

 **in** /Users/shahjahanrana/Library/Developer/CoreSimulator/Devices/102EB53D-F0E0-4905-B774-FAECBD3E3126/data/Containers/Bundle/Application/097F24EC-ECF7-4C79-979E-B25A2BF35073/SampleDemoApp.app/Frameworks/SwrveGeoSDK.framework/SwrveGeoSDK

I have observed there was a common class being used in SwrveSDK which was also being using in SwrveGeoSDK. Now in 7.0.3, Swrve has introduced a separate library SwrveCommonSDK and moved common files over there so SwrveGeoSDK is unable to find it in SwrveSDK.

Please can anyone guide me in this reference. I have forced my pods to use 7.0.2 version as of now so that my library can work fine.
Thanks

Building using Xcode 12.5

Swrve version:
6.8.0

Task:
Build Swrve using Swift Package Manager

Issue:
Fails to build because initializer is made unavailable and using new doesn't work anymore in Xcode 12.5 Beta

Error Message:
'new' is unavailable
SwrveSDK/include/SwrveMessageController.h:47:1: 'init' has been explicitly marked unavailable here

Cause:
SwrveMessageController.h

  • (instancetype)init NS_UNAVAILABLE;

Native SKStoreReviewController requestReview support

I'm wondering what your plan is for native support for [SKStoreReviewController requestReview]?

Currently we use Swrve for a rate the app In-App message and then deep link to rate the App Store. Ideally, we'd like to be able to trigger prompting to rate the app via [SKStoreReviewController requestReview] natively without showing a message beforehand but still using Swrve events to trigger this at the appropriate time.

Swrve messages can cause `unrecognized selector` exception on devices running iOS 8

SwrveMessageViewController.m:

UITapGestureRecognizer *playPress = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(buttonSelected)];
playPress.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause]];
[self.view addGestureRecognizer:playPress];

Unfortunately setAllowedPressTypes is only available from iOS 9

-(void)updateBounds
{
    // Update the bounds to the new screen size
    [self.view setFrame:[[UIScreen mainScreen] bounds]];
    [self.view setNeedsFocusUpdate];
    [self.view updateFocusIfNeeded];
}

setNeedsFocusUpdate and updateFocusIfNeeded are part of UIFocusEnvironment protocol which is also available only from iOS 9

SwrveMessageController.m

[messageViewController setNeedsFocusUpdate];
[messageViewController updateFocusIfNeeded];

Same issue as previous

Dependency on SwrveConversationSDK

Hello!

My company currently uses the pod SwrveSDK for A/B testing, and I'm curious if there's a plan to remove the dependency on SwrveConversationSDK so that for people that don't use it, they don't have to include that code in their bundle.

Swrve Pod integrations caused, additional languages(localizations) in app store listing.

Hi Team,

I got an issue while adding Swrve SDK using Pods. I submitted an app to App Store with Swrve SDK v4.0.5. By observing the build details, there are additional language support added to the build. This causes display of additional languages in app store listing. I checked the generated ipa by unzipping it. I observed some language specific files(*.lproj). Is there any way to restrict unintended language folders or it is any configuration change required?

Swrve 6.3.0 pod was not published

The last version that was published in Pod is Swrve 6.2.1, but I don't wanna use this version because there are some bugs in conversation.

This is the error message when I try to install the 6.3.0 version. When I remove the version in my Podfile, I install the latest publish version (6.2.1)

[!] CocoaPods could not find compatible versions for pod "SwrveSDK":
In Podfile:
SwrveSDK (= 6.3.0)

None of your spec sources contain a spec satisfying the dependency: SwrveSDK (= 6.3.0).

5.2.1 Fails to compile on Xcode 9.3 & Swift 4.1

The SDK fails to compile with the error: Duplicate interface definition for class 'SwrvePush'

Also there's the warning: Duplicate protocol definition of 'SwrvePushResponseDelegate' is ignored

[SwrveSDK Error]

[SwrveSDK Error] Error setting NSFileProtectionNone on file: swrve_cache_version.txt error: The file “swrve_cache_version.txt” doesn’t exist.

Allowing users to disable push notifications

Is there an endpoint for disabling push notifications on a particular device? Ideally I'd like to be able to allow my users to toggle push notifications on and off from within the app with a switch. Is this possible?

make permission request for photo camera optional

To avoid error messages coming from iTunes Connect like

"This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data."

please add a preprocessor macro SWRVE_NO_PHOTO_CAMERA as described in https://docs.swrve.com/faqs/sdk-integration/exclude-optional-ios-frameworks/ to make the camera permission request optional.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.