Git Product home page Git Product logo

Comments (10)

moovida avatar moovida commented on June 19, 2024 1

Alright, I think I found a solution.

I tried to migrate the ios part to swift before but it would not find the background_locator module and therefore not build.

But then I noticed those lines where missing in my Podfile:

target 'Runner' do
  use_frameworks!                                  <-- this one
  use_modular_headers!                         <-- and this one
  # Flutter Pod

  copied_flutter_dir = File.join(__dir__, 'Flutter')

After adding those and running pod install the Pods_Runner.framework is used in the libs section and things are loaded properly.

from background_locator.

mehdok avatar mehdok commented on June 19, 2024

You have Objective-C project, There is no need to add AppDelagate.swift. Just add the following line to your AppDelegate.m file:

#import <background_locator/BackgroundLocatorPlugin.h>

from background_locator.

moovida avatar moovida commented on June 19, 2024

The ios part has been generated when I first started the project and I have no knowledge about it. Maybe previous Object-C were generated instead of Swift.

Anyways your suggestion worked: I placed it in the .h just because there I found imports while the .m had includes. But it should be the same I guess.

Thanks a lot!

from background_locator.

moovida avatar moovida commented on June 19, 2024

Please allow me to reopen this, since it looks related.
On IOS the app crashes at startup when trying to connect. In the crash log I find only this which seems to be related:

Thread 0 name:
Thread 0 Crashed:
0   ???                           	000000000000000000 0 + 0
1   Runner                        	0x000000010037e440 -[BackgroundLocatorPlugin handleMethodCall:result:] + 248
2   Flutter                       	0x000000010087ad20 0x1007ec000 + 584992
3   Flutter                       	0x0000000100818338 0x1007ec000 + 181048
4   Flutter                       	0x000000010086bd5c 0x1007ec000 + 523612
5   Flutter                       	0x0000000100826f58 0x1007ec000 + 241496
6   Flutter                       	0x00000001008291dc 0x1007ec000 + 250332
7   CoreFoundation                	0x00000001ba9b61c0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28 (CFRunLoop.c:1766)
8   CoreFoundation                	0x00000001ba9b5edc __CFRunLoopDoTimer + 880 (CFRunLoop.c:2357)
9   CoreFoundation                	0x00000001ba9b55b8 __CFRunLoopDoTimers + 276 (CFRunLoop.c:2512)
10  CoreFoundation                	0x00000001ba9b05c8 __CFRunLoopRun + 1640 (CFRunLoop.c:0)
11  CoreFoundation                	0x00000001ba9afc34 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3192)
12  GraphicsServices              	0x00000001c4af938c GSEventRunModal + 160 (GSEvent.c:2246)
13  UIKitCore                     	0x00000001beae222c UIApplicationMain + 1932 (UIApplication.m:4820)
14  Runner                        	0x00000001003753a8 main + 88
15  libdyld.dylib                 	0x00000001ba837800 start + 4

I am quite sure I followed the instructions properly, but clearly something is off. DO you see something that might lead me to the error? Thanks a ton.

from background_locator.

gpibarra avatar gpibarra commented on June 19, 2024

Are you running the project "example" inside this repository or is it a new application that you copied the configuration?

from background_locator.

moovida avatar moovida commented on June 19, 2024

@gpibarra it is a different application inside which I am trying to use the library.


update: I have been able to successfully install the example project and run. The only difference I see is the nature of the ios part (swift vs object-c). I will investigate. Thanks for the hint.

from background_locator.

moovida avatar moovida commented on June 19, 2024

Alright, finally been able to run my app throught Xcode on a device. I am getting this:

.pub-cache/hosted/pub.dartlang.org/background_locator-1.1.2+2/ios/Classes/BackgroundLocatorPlugin.m:169
2020-04-28 09:09:13.539639+0200 Runner[361:15753] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'failed to set registerPlugins'

So I assume I am just doing something wrong in the object-c code. Since I have no idea about what I am doing in there, I will try to post my files, since I feel something is missing:

main.m

#import <Flutter/Flutter.h>
#import <UIKit/UIKit.h>
#import "AppDelegate.h"

int main(int argc, char* argv[]) {
  @autoreleasepool {
    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
  }
}

AppDelegate.h

#import <Flutter/Flutter.h>
#import <UIKit/UIKit.h>

@interface AppDelegate : FlutterAppDelegate

@end

AppDelegate.m

#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#import <background_locator/BackgroundLocatorPlugin.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [GeneratedPluginRegistrant registerWithRegistry:self];
  // Override point for customisation after application launch.
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

@end

Shouldn't I be able to call: BackgroundLocatorPlugin.setPluginRegistrantCallback(registerPlugins)
in here somehow?

from background_locator.

moovida avatar moovida commented on June 19, 2024

If it is of interest, I could write a small entry about this migration in the wiki setup part. Maybe another complete ignorant in ios as myself could find benefit.

from background_locator.

mehdok avatar mehdok commented on June 19, 2024

If it is of interest, I could write a small entry about this migration in the wiki setup part. Maybe another complete ignorant in ios as myself could find benefit.

You are very welcome to do that;

from background_locator.

moovida avatar moovida commented on June 19, 2024

It is the least I can do :-)

I just noticed that there is no way to make pull requests against the wiki. I therefore attach my proposal of the setup file (zipped sine github doesn't allow md file to be uploaded):Setup.md.zip

For better readability I inverted the steps. It should not be a problem, but you better check if things look right.

Thanks!

from background_locator.

Related Issues (20)

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.