Giter Site home page Giter Site logo

fliclib-ios's Introduction

Flic Logo Black

fliclib-ios

This is the official iOS framework for the original Flic 1. If you are looking to integrate the new Flic 2, please see https://github.com/50ButtonsEach/flic2lib-ios

Note: As of April 7th, 2020, this framework is distributed as an XCFramework bundle instead of a regular framework bundle.

Getting Started

This framework works in collaboration with the Flic app so please make sure that you have it installed before you begin. The app is free and you can find it in the App Store.

Either follow the quick tutorial below, or take a look at one of our example projects here on GitHub for Swift or Objective-C.

Set up Xcode

Please note that steps 5-6 are optional and only needed if you are building an app that needs to run in the background.

  1. Place the downloaded fliclib.xcframework folder somewhere on you computer, preferably in your project's folder structure.

  2. Drag-and-drop the whole fliclib.xcframework folder from your finder window to the Frameworks, Libraries, and Embedded Content section under the General tab of your application's target setting.

    Ensure that fliclib.xcframework is listed as Embed & Sign:

    Frameworks, Libraries and Embedded Content

    Doing this should automatically add the xcframework to Link Binary With Libraries under the Build Phases tab.

  3. Under Project Settings -> Build Settings, set the flag Allow Non-modular includes in Framework Modules to Yes:

    Allow non Modular

  4. In your project plist file, you need to register your app to handle URL scheme calls. This is needed when you fetch a Flic object from the Flic App. You also need to add the Flic app to the list of Application Query Schemes. Don't worry, we will explain this in greater detail later on. Make sure that your plist file contains something like this:

    Plist

    Of course, make sure that you select a URL that is unique to your specific app. That's it! Xcode is now properly set up to integrate Flic and we can start coding.

  5. In your project settings, check the Uses Bluetooth LE accessories option under Background Modes in the Signing & Capabilities tab.

    Note: If you can't see the options for Background Modes then you need to add that capability by pressing + in the top left corner of that view.

    Checking this option will let iOS know that we want permission to communicate with Flic buttons while the application is in the background.

    Background Modes

  6. It the project's Info.plist file we must now add two keys:

    • Privacy - Bluetooth Peripheral Usage Description
    • Privacy - Bluetooth Always Usage Description

    The first one specifies that we wish to connect with Bluetooth Peripherals and the second one specifies that we will do so in the background. The values that you add here will be displayed to the user when iOS shows its bluetooth permission dialogs.

    Plist Values

Objective-C Code

  1. Import the xcframework module by adding @ import fliclib; wherever it suits your application the best. If you are using Swift, then type @import fliclib instead. In this case we will just add it to the view controller implementation file. We also went ahead and added both of the Button and Manager delegate protocols.

    @ import flic2lib;
    
    @interface ViewController () <SCLFlicButtonDelegate, SCLFlicManagerDelegate>
    
    @end
  2. The first thing we need to do before we can start using the Flic Manager is to configure its singleton. This needs to be done on every application launch.

    In this case we will do so in the viewDidLoad method. The background execution flag specifies whether or not you intend to use the buttons in the background. For this simple example we will set it to YES. The appID and appSecret parameters are unique for every application and can be generated on our developer portal.

    - (void)viewDidLoad
    {
    	[super viewDidLoad];
    	[SCLFlicManager configureWithDelegate:self defaultButtonDelegate:self appID:appID appSecret:appSecret backgroundExecution:YES];
    }
  3. We now have a manager that we can use to grab a button from the Flic app, but before we do that we need to properly set up our URL scheme so that the callback works properly. To accomplish this we have to add a method application:openURL:sourceApplication:annotation: to our AppDelegate.m that will receive the URL callback. In this callback we can just forward it to the manager singleton.

    - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options;
    {
    	return [[SCLFlicManager sharedManager] handleOpenURL:url];
    }
  4. We are now all set to grab our first Flic button. To do this we need to call the grabFlicFromFlicAppWithCallbackUrlScheme: method on the manager singleton. What this call will do is open up the Flic app and present the user with a view where they can choose one of their connected Flics. Once the user has chosen one Flic, it will redirect back to the specified callback URL. We decided to put this feature in an IBAction and hook that up to a UIButton to be displayed in the UI.

    - (IBAction)grab:(id)sender;
    {
    	[[SCLFlicManager sharedManager] grabFlicFromFlicAppWithCallbackUrlScheme:@"yourAppURL"];
    }
  5. We now need to implement the flicManager:didGrabFlicButton:withError: callback in order to get notified when a button has been grabbed. If no error occurred, a new SCLFlicButton instance that is tied to the selected physical Flic has been created. The first thing that we should remember to do is to set the delegate here, unless you have not already set the default delegate on the manager (which we have already done in this example). This would also be a good place do all of your custom button settings in case you need any behavior that is different from the default.

    - (void)flicManager:(SCLFlicManager *)manager didGrabFlicButton:(SCLFlicButton *)button withError:(NSError *)error;
    {
    	if (error)
    	{
    		NSLog(@"Could not grab a Flic: %@", error);
    	}
    }
  6. That's it! You now have a Flic button tied to your app, and you can start using it however you like. For example, lets implement the flicButton:didReceiveButtonDown:age: delegate method to make sure that things are working as they should. Remember that it might take a second or two to connect to the Flic. If you want to be notified of when the Flic is properly connected and ready to use, you can also implement the flicButtonIsReady: method.

    - (void) flicButton:(SCLFlicButton *) button didReceiveButtonDown:(BOOL) queued age: (NSInteger) age;
    {
    	NSLog(@"Yey, it works");
    }

That's it!

Background Execution

This step is optional and only required if you intend to use the Flic buttons while the app is in the background.

  1. Set the backgroundExecution flag to YES when configuring the manager singleton.

  2. When a Flic related event happens while your app is completely terminated the iOS device will re-launch your app to the background. However, since this can now be considered as a brand new launch of the application, we also need to re-initialize fliclib. To do this just initialize the manager as normal when the app boots. When doing this you will after a short time get a callback on the manager delegate, flicManagerDidRestoreState:, where you can collect all Flic buttons again and reset their delegates if needed.

    - (void) flicManagerDidRestoreState:(SCLFlicManager *)manager;
    {
    	// Set the delegate on all buttons if you have not set the default button delegate on the manager.
    }

    If you have your own classes that depend on the button instances then this would also be the safe place to collect the buttons using the knownButtons method. If you have manny buttons and need to distinguish between them then the buttonIdentifier can be used for this purpose.

Simulator Support

The XCFramework bundle will run in the simulator by default, no configuration needed.

Licence

Any documentation or source code contained in this repository is released under CC0. The fliclib binary is released under a separate license which allows you to use it almost without restrictions.

fliclib-ios's People

Contributors

antonmeier avatar jonhocking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar

fliclib-ios's Issues

Couldn't find a license for fliclib-ios

Hello

Couldn't find a license for fliclib-ios. Could you please add one?
If possible a simple and permissive one.
Because in this way people wouldn't be taking a legal risk by using fliclib in custom apps.

Thank you, Jose.

Could not grab Flic

Firstly, thanks for making the SDK available.

I've been able to build an iOS app with the SDK. When I call SCLFlicManager - requestButtonFromFlicAppWithCallback: it opens up the Flic app, but none of my buttons appear to be compatible. I haven't been able to find anywhere in "settings" or documentation that indicate how to make the Flic compatible.

What should I do?

img_4351

fliclib.framework with White Label Framework in 1 Project

We have an iOS app that is using the fliclib.framework perfectly. We also now have the white label framework that you have provided us. We want to use both in our project so users can use both the normal flic buttons as well as our white label ones.

Is this possible or will I encounter issues?

errors when attempting to archive IPA

Hi, i have bitcode enabled in my build settings but when trying to archive the app into an IPA i get

ld: bitcode bundle could not be generated because '/GitHub/app/fliclib.framework/fliclib' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

any suggestions? was the framework built without full bitcode?

Not working with XCode 8.3

I upgraded to XCode 8.3 and now I get linker errors as follows when building my project. Also have same issues with your "ios-boilerplate-swift" project.

Do you know what might be wrong? Does it just require you to compile against 8.3 for the framework?

ld: warning: ignoring file /Users/dboyd/dev/assure/assure-ios/fliclib.framework/fliclib, missing required architecture i386 in file /Users/dboyd/dev/assure/assure-ios/fliclib.framework/fliclib (2 slices)
Undefined symbols for architecture i386:
"OBJC_CLASS$_SCLFlicButton", referenced from:
objc-class-ref in ViewController.o
"OBJC_CLASS$_SCLFlicManager", referenced from:
objc-class-ref in ViewController.o
objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture i386

Flic creates database files in Documents directory

Hi,

Is there a way of specifying the directory that the database files are written to? They appear to be written to the Documents directory on iOS and I can't see a way of changing this in the SDK. Our app has just failed review because we share the Documents directory and didn't realise Flic dumps database files there.

Thanks!

Application is not working in terminated mode

Hello,
I successfully implemented flic code in my appdelegate from which I am handling my flic click events. All is working cool if it is in foreground and background mode. But when I close app from background (terminated mode) and click on flic button then it is not responding(not able to get clicks). and when I click on application icon then it is asking for discover again.

Please help me. I am near to complete my flic task.
Thanks.

Bot example

Hi,
I dont know how to integrate bot in our iOS app . Can anybody help me?

Unable to compile Unit Tests

I'm using the flic API in a Swift application and have been able to use the buttons but I can't get the project to compile for unit tests.

using the latest version of Xcode and Swift on a El Capitan Macbook Pro.

ld: warning: ignoring file /Users/yoann/Documents/Dev/hOme/hOme/fliclib.framework/fliclib, missing required architecture x86_64 in file /Users/yoann/Documents/Dev/hOme/hOme/fliclib.framework/fliclib (2 slices) Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_SCLFlicButton", referenced from: type metadata accessor for __ObjC.SCLFlicButton in FlicManager.o type metadata accessor for __ObjC.SCLFlicButton in FlicButton.o "_OBJC_CLASS_$_SCLFlicManager", referenced from: type metadata accessor for __ObjC.SCLFlicManager in FlicManager.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

How could I get the project to compile for the unit tests?
I did email the client support but I couldn't get any answer on API related questions.

error connecting to button since fliclib update?

Hi, having issues with connecting to the button recently since the lib update.. getting this error on delegate call to flicbutton(button, didFailToConnectWithError)...

Error Domain=com.shortcutlabs.fliclib Code=10 "The operation couldn’t be completed. (com.shortcutlabs.fliclib error 10

any suggestions?

Flic Grabber won't let me select any of my buttons

I'm trying to integrate Flic into my iOS project using your tutorial. I got to the point where I was trying to add a button to to Flic Manager, but none of them were available to select and I got an error alert (pictures attached). Why is this happening?

Any advice or help would be appreciated.

img_0474

Old 'startScan & stopScan' methods

Hello, first thanks for supporting this library, thanks

I have a project with the library when using manager methods:

SCLFlicManager.startScan
SCLFlicManager.stopScan

Now I want to implement the new version, including the fix for Xcode 11.4 (xcframework), but these methods were removed, I did not find the commit (sorry if it was a novice), so I would like to know if these methods are no longer necessary, or how it is the new handling?

Best regards

grabFlicFromFlicApp opens store instead flic app

Hi!

I'm not sure if I did everything correctly, but I had followed everything that the tutorial offered, and when I fire grabFlicFromFlicApp then it opens the app store at the flic app (I have already installed this app, and have used the button there)

Building for Mac Catalyst with Xcode 12

I'm using the fliclib framework in my iOS and Mac Catalyst project. I have the latest version of the framework (1.4.0), I have the project set to embed it only in iOS, and I have all the related code hidden from macOS with #if !TARGET_OS_MACCATALYST.

Before Xcode 12, the project would build for both platforms. With Xcode 12, the project will only build for iOS with the framework set to "Embed and Sign" and will only build for macOS with the framework set to "Embed Without Signing." I'm attaching the error that is shown if I try building with "Embed and Sign" as in previous Xcode versions. Two other third-party frameworks are fine.

Is this an issue with Xcode, or something that needs to be addressed in the framework?

Screen Shot 2020-09-23 at 1 04 28 PM

Screen Shot 2020-09-23 at 1 09 37 PM

Archive failing

Everything looks good from a compilation point of view with the new xcframework version. Thank you for putting that version out. This is a much better solution over all.

However, after running my branch adopting this new version on the build server we ran across an issue with the archive.

I'm having trouble deciphering the errors here, but we were able to reproduce this locally with Xcode 11.3. We plan to test newer versions of Xcode on Monday to see if that's the issue.

So two questions for you. First is there a new minimum requirement for Xcode (beyond 11.0 for XCFramework support) or a new minimum requirement for iOS deployment target? We noticed in the info.plist for fliclib.framework the DTPlatformVersion is 13.4.

The second question is do any of these logs make sense to you? Does it point to a specific problem that you know of?

Thanks for any help.

Stdout:
    Debug: SDK path: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk
    Debug: SDK version: 13.2
    Debug: PATH: ['/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin', '/Applications/Xcode.app/Contents/Developer/usr/bin']
    Debug: Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo
    MachoInfo: cd /
    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo" "-info" "/var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/ipatool20200430-69559-j7fcfc/thinned-in/arm64/Payload/Redacted.app/Frameworks/fliclib.framework/fliclib"
    -= Output =-
    Non-fat file: /var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/ipatool20200430-69559-j7fcfc/thinned-in/arm64/Payload/Redacted.app/Frameworks/fliclib.framework/fliclib is architecture: arm64
    Exited with 0
    
    Debug: Command took 0 seconds
    Debug: Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dwarfdump
    GetUUID: cd /
    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dwarfdump" "-u" "/var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/ipatool20200430-69559-j7fcfc/thinned-in/arm64/Payload/Redacted.app/Frameworks/fliclib.framework/fliclib"
    -= Output =-
    UUID: 08149767-509F-34B7-B8A7-A29B59192A3B (arm64) /var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/ipatool20200430-69559-j7fcfc/thinned-in/arm64/Payload/Redacted.app/Frameworks/fliclib.framework/fliclib
    Exited with 0
    
    Debug: Command took 0 seconds
    Debug: Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/segedit
    ExtractXAR: cd /
    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/segedit" "/var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/ipatool20200430-69559-j7fcfc/thinned-in/arm64/Payload/Redacted.app/Frameworks/fliclib.framework/fliclib" "-extract" "__LLVM" "__bundle" "/var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/fliclibRXr5NM/fliclib.arm64.xar"
    -= Output =-
    Exited with 0
    
    Debug: Command took 0 seconds
    Debug: Bitcode bundle version: 1.0
    Debug: Setting platform to: iOS
    Debug: Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
    Debug: Using: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
    Clang: cd /var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/tempZvkUJJ
    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" "-cc1" "-triple" "arm64-apple-ios8.0.0" "-emit-obj" "-disable-llvm-passes" "-faligned-alloc-unavailable" "-target-sdk-version=13.4" "-target-abi" "darwinpcs" "-Os" "-x" "ir" "01" "-o" "01.o"
    -= Output =-
    Exited with 0
    
    Debug: Command took 0 seconds
    error: Clang: cd /var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/tempZvkUJJ
    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" "-cc1" "-triple" "arm64-apple-ios8.0.0" "-emit-obj" "-disable-llvm-passes" "-faligned-alloc-unavailable" "-target-sdk-version=13.4" "-target-abi" "darwinpcs" "-Os" "-x" "ir" "02" "-o" "02.o"
    -= Output =-
    error: Unknown attribute kind (60) (Producer: 'APPLE_1_1103.0.32.29_0' Reader: 'LLVM APPLE_1_1100.0.33.17_0')
    1 error generated.
    Exited with 1
    
    
    error: Failed to compile bundle: /var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/fliclibRXr5NM/fliclib.arm64.xar
    
    error: Clang: cd /var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/tempZvkUJJ
    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" "-cc1" "-triple" "arm64-apple-ios8.0.0" "-emit-obj" "-disable-llvm-passes" "-faligned-alloc-unavailable" "-target-sdk-version=13.4" "-target-abi" "darwinpcs" "-Os" "-x" "ir" "08" "-o" "08.o"
    -= Output =-
    error: error reading '08'
    1 error generated.
    Exited with 1
    
    
    error: Failed to compile bundle: /var/folders/rj/0ky8l48554x1z5lj36trcmjs242bs2/T/fliclibRXr5NM/fliclib.arm64.xar

Add a field "event datetime" for the Button

For example, in case of Bluetooth is disabled, and I click the Flic, then I turn Bluetooth on and I will immediately receive an event (Flic was clicked didReceiveButtonClick), but I don't know exactly time when Flic was clicked.

Is it possible to add event date-time field (when Fic was clicked) for the Flic button?

React Native Integration

Could anybody point me in the right direction implementing the Flic SDK in combination with React Native? I have been looking into this and have had no luck so far.

Did anybody achieve this and if so, are there any examples available?

Unable to query battery level

I have an application where it is unusually important for Flic buttons to work at all times. So I have a strong need for an in-app low battery level warning. To implement this though, I would need the ability to query a Flic for its battery level. Why can't we query a Flic for its battery level?

Flic 2 support

Do we need a framework update to support the Flic 2? It hasn't been updated since long before the Flic 2 launch, but a user with a Flic 2 says his button shows as "Not Compatible" in the picker.

flic_2

Building for simulator not working with Xcode 11.4

With the release of Xcode 11.4 we're encountering a new error.

Building for iOS Simulator, but the embedded framework 'fliclib.framework' was built for iOS.

It's working fine on older versions so it seems that Xcode 11.4 does a stricter check on what it embeds in a target.

As far as I know there's no easy way to conditionally embed frameworks in Xcode, so it would require some non trivial scripting.

Application not working in terminated mode for Powered by flick button

Hello,
I successfully implemented flic code in my appdelegate from which I am handling my flic click events. All is working cool if it is in foreground and background mode. But when I close app from background (terminated mode) and click on flic button then it is not responding(not able to get clicks). and when I click on application icon then it is asking for discover again.

Please help me. I am near to complete my flic task.
Thanks.

Button connected but no messages received

I have a couple users with a first-generation Flic button who are reporting that my app receives no messages from the buttons. Here's what I know:

  • Users are clicking a button in my app that calls [[SCLFlicManager sharedManager] grabFlicFromFlicAppWithCallbackUrlScheme:@"[appscheme]"]. This goes to the Flic app, which shows the button, which they click and then click Done to return to my app, as expected.
  • My app is calling [[SCLFlicManager sharedManager] knownButtons] and that shows that the button is connected.
  • Users click the Flic button, and they hear the Flic app beeping to indicate it is receiving the message.
  • My app's didReceiveButtonClick method is NOT called.

This works fine with my Flic button, on an iPhone or iPad with iOS 13.3. Both these users have iOS 13.3. One user says that he has a different device with iOS 12 and the button works as expected there.

I did find a problem where I was checking for an error in didGrabFlicButton and returning, and setting button.triggerBehavior after that. So a button that was already known to the device, but which somehow forgot its triggerBehavior setting, would trigger didReceiveButtonClick and didReceiveButtonHold but not didReceiveButtonDoubleClick. Is there a default triggerBehavior setting that would cause it to not trigger any of these methods?

Otherwise, is there anything else I can check to find out what's wrong? (I don't have access to the devices to debug with.)

Minimum Target is iOS 8

Hello Flic iOS-Team,

i added Flic support (API 1.1.11) to my iOS app "Chillout Control". I released a new version a few days ago with compatibility starting at iOS 5.1.1 until iOS 10.2.
Now your framework requires a minimum of iOS 8.0

Is it possible to include/link your framework (also with 5.1.1) and just invoke/use it on iOS >= 8.0?

Linker command failed:
embedded dylibs/frameworks are only supported on iOS 8.0 and later (@rpath/fliclib.framework/fliclib) for architecture arm64

I hope it does not look the same with the Android Library

Regards,
Thomas Kirschner

Chillout Control iOS App:
https://itunes.apple.com/de/app/chillout-control/id429895993?mt=8

swift compatibility

hi, built a basic swift app with the latest library and getting these errors on compile... any ideas?
here's the sample code with demo appid and appsecret keys:
https://gist.github.com/729bc24a493c23af546f.git

Undefined symbols for architecture x86_64:
"OBJC_CLASS$_SCLFlicButton", referenced from:
testflic.ViewController.flicManagerDidRestoreState (testflic.ViewController)(ObjectiveC.SCLFlicManager) -> () in ViewController.o
type metadata accessor for ObjectiveC.SCLFlicButton in ViewController.o
"OBJC_CLASS$_SCLFlicManager", referenced from:
type metadata accessor for ObjectiveC.SCLFlicManager in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

didReceiveButtonDoubleClick:queued:age not called

Hey guys,

I'm the vendor of Ti.Flic, a native module for the Appcelerator Titanium framework. All works fine so far (connecting, getting clicks and button-down/ups), except that the double-clicks are not fired.

The used Flic button is "Siyou Flic" (green) and everything looks correct on the module's side.

Ability to subscribe on application handleOpenURL out of appDelegate.m

Hello,
Will this work, in case I subscribe on event "handleOpenURL", outside of appDelegate.m?
For example, I can subscribe on event in cordova plugin:

FlicPlugin.m:

-(void)pluginInitialize
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:)name:@"flicApp" object:nil];
}
-(void)handleOpenURL:(NSNotification*)notification
{
   NSURL* url = [notification object];

   if ([url isKindOfClass:[NSURL class]]) {
        [[SCLFlicManager sharedManager] handleOpenUrl: url];
   }
}

I have done it, and:

  • I can grab flic button
  • But a flic button events does not happened

Have you tried to subscribe on event "handleOpenURL" outside of appDelegate.m?

didGrabFlicButton never called

Hi all, after following both the iOS integration tutorial and the example Objective C project, I still cannot get my app to grab the button. I'm taken to the Flic app and can select the button and am properly redirected back to my app, but the didGrabFlicButton method is never called. Has anyone experienced this issue before and would know anything about why it might be occurring?

__46-[BCBCentralManager monitorPendingConnections]_block_invok crash

Hi, i'm using onLocationChange method like this :

func locationManager(manager: CLLocationManager, didUpdateToLocation newLocation: CLLocation, fromLocation oldLocation: CLLocation) {
        SCLFlicManager.sharedManager()?.onLocationChange()
}

I'm getting this crash many time from my users :

Crashed: com.apple.root.user-initiated-qos
0  libobjc.A.dylib                0x18cbed704 objc_object::release() + 8
1  fliclib                        0x101398800 __46-[BCBCentralManager monitorPendingConnections]_block_invoke + 216
2  libdispatch.dylib              0x18d0251c0 _dispatch_client_callout + 16
3  libdispatch.dylib              0x18d032008 _dispatch_continuation_pop + 576
4  libdispatch.dylib              0x18d03e648 _dispatch_source_latch_and_call + 204
5  libdispatch.dylib              0x18d027164 _dispatch_source_invoke + 820
6  libdispatch.dylib              0x18d03538c _dispatch_root_queue_drain + 572
7  libdispatch.dylib              0x18d0350ec _dispatch_worker_thread3 + 124
8  libsystem_pthread.dylib        0x18d22d2c8 _pthread_wqthread + 1288
9  libsystem_pthread.dylib        0x18d22cdb4 start_wqthread + 4

Any idea ?

Double click event never happens

I am trying to subscribe to a double click event,
But a double click event never happens.
I've forked your repository, and added subscribers to events

- buttonClick
- buttonDoubleClick
- buttonHold

buttonClick event is happened
buttonHoldevent is happened

but
buttonDoubleClicknever is happened

If I double click on flic, I received two buttonClick events instead one buttonDoubleClick event

Could you tell me what am I doing wrong?

dukhanov/ios-boilerplate-objc@5288d40

UI API called on a background thread

Hi!

I'm integrating the Flic button into a Swift iOS project, and sometimes inconsistently, I get the following error:

=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 2403, TID: 1846784, Thread name: (none), Queue name: com.flicLib.queue, QoS: 0
Backtrace:
4   fliclib                             0x00000001033c3424 -[SCLFlicButton internal_buttonCharacteristicsWasUpdated:] + 588
5   fliclib                             0x00000001033c4d44 -[SCLFlicButton peripheral:didUpdateValueForCharacteristic:error:] + 304
6   fliclib                             0x00000001033b0f90 -[BCBPeripheral peripheral:didUpdateValueForCharacteristic:error:] + 452
7   CoreBluetooth                       0x000000018909ab4c <redacted> + 248
8   CoreBluetooth                       0x000000018909acac <redacted> + 132
9   CoreBluetooth                       0x0000000189096498 <redacted> + 364
10  CoreBluetooth                       0x0000000189090fc8 <redacted> + 208
11  CoreBluetooth                       0x000000018909f540 <redacted> + 60
12  libdispatch.dylib                   0x00000001040952cc _dispatch_call_block_and_release + 24
13  libdispatch.dylib                   0x000000010409528c _dispatch_client_callout + 16
14  libdispatch.dylib                   0x00000001040a3f80 _dispatch_queue_serial_drain + 696
15  libdispatch.dylib                   0x00000001040987ec _dispatch_queue_invoke + 332
16  libdispatch.dylib                   0x00000001040a3d9c _dispatch_queue_serial_drain + 212
17  libdispatch.dylib                   0x00000001040987ec _dispatch_queue_invoke + 332
18  libdispatch.dylib                   0x00000001040a4f6c _dispatch_root_queue_drain_deferred_wlh + 428
19  libdispatch.dylib                   0x00000001040ac020 _dispatch_workloop_worker_thread + 652
20  libsystem_pthread.dylib             0x000000018380af1c _pthread_wqthread + 932
21  libsystem_pthread.dylib             0x000000018380ab6c start_wqthread + 4

This doesn't seem to be originating from my own code, as I've double-checked all places where I interface with the UI, and wrapped properly so that it executes on main thread.

It occurs right after a buttonUp/Click event -- but not consistently.

Add slices for x86 & i386 (iOS Simulator)

Please add slices for the iOS Simulator to the framework. As of now it is not possible to even build a project for the simulator as it fails during linking.
I completely understand that functionality would be limited on the simulator, but even if the framework would do nothing it would be a great improvement over the current situation.

For information on how to achieve such a universal framework (with slices for the various iOS and Simulator architectures check out this article, this post on the developer forums and last but not least this script

3rd party sdk

hi, any timeframe on when a 3rd party sdk will be available so that we dont have to rely on the flic app to add a flic button?

How to get a color value of the button?

I have two buttons (Black and White), and I am trying to get color of the buttons:

NSString *colorString = [CIColor colorWithCGColor:button.color.CGColor].stringRepresentation;
NSLog(@"colorString: %@", colorString);

And I receive string representation of color:

colorString1: 1 1 0 1
colorString1: 0.156863 1 0 1

Description from Apple docs https://developer.apple.com/library/ios/documentation/GraphicsImaging/Reference/QuartzCoreFramework/Classes/CIColor_Class/index.html#//apple_ref/occ/instm/CIColor/stringRepresentation:

Discussion
The string representation always has four components—red, green, blue, and alpha. The default value for the alpha component is 1.0. For example, this string:

@"0.5 0.7 0.3 1.0"

These values do not look like white or black:

colorString1: 1 1 0 1
colorString1: 0.156863 1 0 1

How I can get the correct color value of a button?

project can no longer run on iOS simulator after adding fliclib

the fliclib framework is missing architectures needed by the iOS simulator. So after adding fliclib to my project, my project can no longer build and run on an iOS simulator.

I understand that Flic integration is not possible on a simulator. The behavior I would like to see though is that a project can still compile and run on the simulator after adding the flic framework so I can still test the rest of my app on a simulator. This could be done by, for example, stubbing out a fliclib implementation that does nothing on a simulator.

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.