medyas / flutter_qiblah

Flutter Qiblah is a plugin that allows you to display Qiblah direction in you app with support for both Android and iOS.
https://pub.dev/packages/flutter_qiblah
MIT License
127 stars 91 forks source link

Loading indicator in iOS . Works on Android #10

Closed thatsenam closed 3 years ago

thatsenam commented 3 years ago

I added permission in info.list

` NSLocationAlwaysUsageDescription

This app needs access to location when in the background.
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to location when open.</string>`

its not working and showing a loading ... forever screen instead when I am showing compass.

medyas commented 3 years ago

@thatsenam can you provide you app log ? check the log for any error

thatsenam commented 3 years ago

i already checked the log but found nothing. @medyas

medyas commented 3 years ago

have you run the example app ? it should work.

thatsenam commented 3 years ago

I implemented on my existing project. I am using the latest version flutter_compass: ^0.5.1 flutter_qiblah: ^1.0.3+2 .

thatsenam commented 3 years ago

I copied all code from the example app and successfully run it on android version. but its not working on iOS version. I DID NOT CHANGED ANY SINGLE LINE OF YOUR EXAMPLE CODE. except the main class name. MyApp to QiblaScreen to launch from another activity/widget.

thatsenam commented 3 years ago

@medyas this is the code i am using

import 'package:Oldham/widgets/header.dart';
import 'package:flutter/material.dart';
import 'package:flutter_qiblah/flutter_qiblah.dart';
import 'package:Oldham/screens/qibla/loading_indicator.dart';
import 'package:Oldham/screens/qibla/qiblah_compass.dart';
import 'package:Oldham/screens/qibla/qiblah_maps.dart';

class QiblaScreen extends StatefulWidget {
  @override
  _QiblaScreenState createState() => _QiblaScreenState();
}

class _QiblaScreenState extends State<QiblaScreen> {
  final _deviceSupport = FlutterQiblah.androidDeviceSensorSupport();

  @override
  Widget build(BuildContext context) {
    return buildHeader(title: "Qibla",child: FutureBuilder(
      future: _deviceSupport,
      builder: (_, AsyncSnapshot<bool> snapshot) {
        if (snapshot.connectionState == ConnectionState.waiting)
          return LoadingIndicator();
        if (snapshot.hasError)
          return Center(
            child: Text("Error: ${snapshot.error.toString()}"),
          );
        return QiblahCompass();
      },
    ));
  }
}
thatsenam commented 3 years ago

@medyas i tried running the example app and here is the log Here is the screenshot of the result -> https://imgur.com/a/Izo03Td

event sent after app closed: {id: 0, progressId: null, message: Running "flutter pub get" in example...}
event sent after app closed: {id: 0, progressId: null, finished: true}
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App Store.
Running pod install...
Running Xcode build...
Xcode build done.                                           62.5s
Waiting for iPhone 12 Pro Max to report its views...
Debug service listening on ws://127.0.0.1:51947/t062pZxzWAg=/ws
Syncing files to device iPhone 12 Pro Max...
medyas commented 3 years ago

@thatsenam are you testing in an Ios Simulator ?

thatsenam commented 3 years ago

@medyas yes

medyas commented 3 years ago

you need to test on real ios device for this to work. ios simulator are not as the android emulator, they do not support alot of things.

opsquid commented 1 year ago

you need to test on real ios device for this to work. ios simulator are not as the android emulator, they do not support alot of things.

Confirmed. There's nothing wrong with the code. The simulator just can't get the "snapshot.connectionState" properly. Thank you.