Git Product home page Git Product logo

Comments (19)

tim-hub avatar tim-hub commented on August 24, 2024 1

yeah, thanks for your help in advance, I will test in next monday

from qrcoder.

codebude avatar codebude commented on August 24, 2024

Hi Tim,

I'm neither an Unity expert nor do I own an iOS device. The Unity code was written by @alexnsfx and just pulled into the repo by me. So maybe he can give us a hint.

For now, could you please give more details about "it did not work"? Can you deliver some kind of stack trace or exception message?

from qrcoder.

tim-hub avatar tim-hub commented on August 24, 2024

When it run on unity edtitor, win/mac both run well. Android well too, but ios, it does not, I think the reason may be at Texture2D image =qr.GetGraphic(20);

        QRCodeGenerator gen=new QRCodeGenerator();

        PayloadGenerator.Url url=new PayloadGenerator.Url("http://tim.bai.uno"); 

        QRCodeData qrCodeData =gen.CreateQrCode(url.ToString(),QRCodeGenerator.ECCLevel.L);

        UnityQRCode qr=new UnityQRCode(qrCodeData);

        Texture2D image =qr.GetGraphic(20);


        GetComponent<Renderer>().sharedMaterial.mainTexture=image;

I'm not sure, but I'll do my best to test it and give the feedback.

from qrcoder.

codebude avatar codebude commented on August 24, 2024

Hi @tim-hub ,

could you please try the following and tell me, if this fixed your problems.

Please change line 37 in UnityQRCode.cs from:

var gfx = new Texture2D(size, size, TextureFormat.ARGB32, false);
to
var gfx = new Texture2D(size, size, TextureFormat.RGBA32, false);

(I've read that iOS doesn't support ARGB32, but I can't test it, so please test it for me.)

from qrcoder.

codebude avatar codebude commented on August 24, 2024

And don't forget to sync/checkout the newest version of the library. I've added some major bugfixes today.

from qrcoder.

tim-hub avatar tim-hub commented on August 24, 2024

I seemed that is still not work.

from qrcoder.

codebude avatar codebude commented on August 24, 2024

I'm sorry, but the TextureFormat thing was my only idea. I don't know how to help you, without getting more information on the error. Can you debug your app and give me more detailed information?
http://forum.unity3d.com/threads/debugging-c-on-ios-device.96551/

from qrcoder.

Biodam avatar Biodam commented on August 24, 2024

Hello.
It really doesn't work on iOS. I have a Mac and iOS devices where I work, but really don't understand Xcode to try debug.

If you get any help on this I can try to help. Sorry about this vague response.

from qrcoder.

codebude avatar codebude commented on August 24, 2024

Hey @tim-hub , hi @Biodam - some days are gone and so there are some news. Since I implemented a PCL version of the library, would you be so kind, to test again with the PCL version? Just use the "QRCoderProject.Portable.sln" project to compile the QRCoder.dll (or grab it from the Nuget package).

The portable version has only one QRCode type (BitmapByteQRCode). You can use it as described in the following:

QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode("The text which should be encoded.", QRCodeGenerator.ECCLevel.Q);
BitmapByteQRCode qrCode = new BitmapByteQRCode(qrCodeData);
byte[] qrCodeImage = qrCode.GetGraphic(20);

// Create a texture. Texture size does not matter, since
// LoadImage will replace with with incoming image size.
Texture2D tex = new Texture2D(2, 2);
tex.LoadImage(qrCodeImage);

from qrcoder.

yangyujiang avatar yangyujiang commented on August 24, 2024

Hey @codebude , I tried to test the PCL version , but got an error when I import the QRCoder.dll to Unity.(Unity5.4.3p2 32bit)

Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 

The following assembly referenced from F:\work\snake\trunk_mobile\Assets\Plugins\QRCoder.dll could not be loaded:
     Assembly:   System.Runtime    (assemblyref_index=0)
     Version:    4.0.0.0
     Public Key: b03f5f7f11d50a3a
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (F:\work\snake\trunk_mobile\Assets\Plugins\).

Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Missing method .ctor in assembly F:\work\snake\trunk_mobile\Assets\Plugins\QRCoder.dll, type System.Runtime.Versioning.TargetFrameworkAttribute
Can't find custom attr constructor image: F:\work\snake\trunk_mobile\Assets\Plugins\QRCoder.dll mtoken: 0x0a00000e

And I also tried the common version , but I can't get it work on android. Got the error as below

12-07 13:29:26.971 31560 31581 I Unity   : InvalidOperationException: Operation
is not valid due to the current state of the object
12-07 13:29:26.971 31560 31581 I Unity   :   at System.Linq.Enumerable.First[Met
hodInfo] (IEnumerable`1 source, System.Func`2 predicate, Fallback fallback) [0x0
0000] in <filename unknown>:0
12-07 13:29:26.971 31560 31581 I Unity   :   at System.Linq.Enumerable.First[Met
hodInfo] (IEnumerable`1 source, System.Func`2 predicate) [0x00000] in <filename
unknown>:0
12-07 13:29:26.971 31560 31581 I Unity   :   at QRCoder.QRCodeGenerator+ModulePl
acer.MaskCode (QRCoder.QRCodeData& qrCode, Int32 version, System.Collections.Gen
eric.List`1& blockedModules, ECCLevel eccLevel) [0x00000] in <filename unknown>:
0
12-07 13:29:26.971 31560 31581 I Unity   :   at QRCoder.QRCodeGenerator.CreateQr
Code (System.String plainText, ECCLevel eccLevel, Boolean forceUtf8, Boolean utf
8BOM) [0x00000] in <filename unknown>:0
12-07 13:29:26.971 31560 31581 I Unity   :   at ShareUI+<GenerateTwoDimension>c_
_Iterator3.MoveNext () [0x00000] in <filename unknown>:0
12-07 13:29:26.971 31560 31581 I Unity   :   at UnityEngine.SetupCoroutine.Invok
eMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <file
name unknown>:0

Any help will be appreciated.

from qrcoder.

codebude avatar codebude commented on August 24, 2024

Hi @yangyujiang would it be ok for you, to send me some sample code or your sample project? So that I can debug, what's going wrong?

from qrcoder.

codebude avatar codebude commented on August 24, 2024

@yangyujiang one more idea. The PCL library is built with target x86. Grab the code from GitHub an try to compile the PCL library with target ARM. Maybe this helps to run on your Android.

from qrcoder.

tilkinsc avatar tilkinsc commented on August 24, 2024

It has been over 5 months since a reply. Is this dead, especially because no traffic inquiring?

from qrcoder.

codebude avatar codebude commented on August 24, 2024

@Hydroque - since I neither have an iPhone nor I'm really experienced in Unity, I can't handle this problem alone. But since this problem existed I didn't want to close it, before I have a proof that this problem is fixed.

In 1-2 months I'll get a iPhone, so that I can test it myself. So long I like to keep this issue open.

from qrcoder.

tilkinsc avatar tilkinsc commented on August 24, 2024

I wonder if it reproduces on an emulator.

from qrcoder.

knocte avatar knocte commented on August 24, 2024

@codebude did you get that iPhone you said you would have?

from qrcoder.

Ruffio avatar Ruffio commented on August 24, 2024

Is this issue still relevant?

from qrcoder.

codebude avatar codebude commented on August 24, 2024

Hi @Ruffio - I'm sorry, but I can't say if this is fixed, because I still don't have an iPhone dev environment. If you can help to solve this I would be happy.

from qrcoder.

tim-hub avatar tim-hub commented on August 24, 2024

@codebude Sorry for late reply, I did not try the PCL version yet. It takes a really long time for this issue.

from qrcoder.

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.