Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does it support ios device on unity? #32

Closed
tim-hub opened this issue May 13, 2016 · 19 comments
Closed

does it support ios device on unity? #32

tim-hub opened this issue May 13, 2016 · 19 comments

Comments

@tim-hub
Copy link

tim-hub commented May 13, 2016

It worked weel when I run it on unity editor (mac), but when I publish to ios device, it seemed that it did not work.

@codebude
Copy link
Owner

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?

@tim-hub
Copy link
Author

tim-hub commented May 13, 2016

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.

@codebude
Copy link
Owner

codebude commented May 13, 2016

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.)

@codebude codebude added the bug label May 13, 2016
@tim-hub
Copy link
Author

tim-hub commented May 15, 2016

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

@codebude
Copy link
Owner

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

@tim-hub
Copy link
Author

tim-hub commented May 16, 2016

I seemed that is still not work.

@codebude
Copy link
Owner

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/

@Biodam
Copy link

Biodam commented May 25, 2016

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.

@codebude
Copy link
Owner

codebude commented Sep 13, 2016

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);

@yangyujiang
Copy link

yangyujiang commented Dec 7, 2016

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.

@codebude
Copy link
Owner

codebude commented Dec 9, 2016

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?

@codebude
Copy link
Owner

codebude commented Dec 9, 2016

@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.

@tilkinsc
Copy link

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

@codebude
Copy link
Owner

@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.

@tilkinsc
Copy link

I wonder if it reproduces on an emulator.

@knocte
Copy link

knocte commented Mar 25, 2018

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

@Ruffio
Copy link

Ruffio commented Jun 14, 2018

Is this issue still relevant?

@codebude
Copy link
Owner

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.

@tim-hub
Copy link
Author

tim-hub commented Oct 15, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants