barcodescanner not working with phonegap.1.2.0

304 views
Skip to first unread message

fenta23

unread,
Nov 9, 2011, 5:03:43 AM11/9/11
to phonegap
Hello all,

i recently updated phonegap1.2.0 and migrated my project to the new
application. i imported the barcodescanner and got the following
error:

/<mypath>/PGBarcodeScanner.mm:21:26: error: PhoneGap/JSON.h: No such
file or directory

and

file://<mypath>/PGBarcodeScanner.mm: error: Lexical or Preprocessor
Issue: 'PhoneGap/JSON.h' file not found

any ideas?


thx in advance....
Micha.

Giorgio Delle Grottaglie

unread,
Nov 9, 2011, 10:44:30 AM11/9/11
to phon...@googlegroups.com
Replace 
#import <Phonegap/JSON.h>
with
#import <Phonegap/JSONKit.h>

Michael P

unread,
Nov 10, 2011, 5:02:59 AM11/10/11
to phon...@googlegroups.com
Gave it a try, but produce even more errors.

First error:
file://<mypath>/PGBarcodeScanner.mm: error: Semantic Issue:
'autorelease' is unavailable: not available in automatic reference
counting mode
file://<mypath>/PGBarcodeScanner.mm: error: Automatic Reference
Counting Issue: ARC forbids explicit message send of 'autorelease'
file://<mypath>/PGBarcodeScanner.mm: error: Automatic Reference
Counting Issue: ARC forbids explicit message send of 'dealloc'
file://<mypath>/PGBarcodeScanner.mm: error: Semantic Issue:
'autorelease' is unavailable: not available in automatic reference
counting mode
...
And some undefined symbols???

Undefined symbols for architecture armv7:
"zxing::Result::getBarcodeFormat() const", referenced from:
-[PGbcsProcessor
captureOutput:didOutputSampleBuffer:fromConnection:] in
PGBarcodeScanner.o
"zxing::MultiFormatReader::MultiFormatReader()", referenced from:
-[PGbcsProcessor
captureOutput:didOutputSampleBuffer:fromConnection:] in
PGBarcodeScanner.o
"zxing::DecodeHints::DecodeHints()", referenced from:
-[PGbcsProcessor
captureOutput:didOutputSampleBuffer:fromConnection:] in
PGBarcodeScanner.o
"zxing::DecodeHints::addFormat(zxing::BarcodeFormat)", referenced from:
-[PGbcsProcessor
captureOutput:didOutputSampleBuffer:fromConnection:] in
PGBarcodeScanner.o
"zxing::ReaderException::ReaderException(char const*)", referenced from:
-[PGbcsProcessor getLuminanceSourceFromSample:imageBytes:] in
PGBarcodeScanner.o
"zxing::Result::getText()", referenced from:
-[PGbcsProcessor
captureOutput:didOutputSampleBuffer:fromConnection:] in
PGBarcodeScanner.o
"zxing::HybridBinarizer::HybridBinarizer(zxing::Ref<zxing::LuminanceSource>)",
referenced from:
-[PGbcsProcessor
captureOutput:didOutputSampleBuffer:fromConnection:] in
PGBarcodeScanner.o
"typeinfo for zxing::ReaderException", referenced from:
typeinfo for zxing::ReaderException*in PGBarcodeScanner.o
GCC_except_table60 in PGBarcodeScanner.o
"zxing::GreyscaleLuminanceSource::GreyscaleLuminanceSource(unsigned
char*, int, int, int, int, int, int)", referenced from:
-[PGbcsProcessor getLuminanceSourceFromSample:imageBytes:] in
PGBarcodeScanner.o
"zxing::BinaryBitmap::BinaryBitmap(zxing::Ref<zxing::Binarizer>)",
referenced from:
-[PGbcsProcessor
captureOutput:didOutputSampleBuffer:fromConnection:] in
PGBarcodeScanner.o
"zxing::String::getText() const", referenced from:
-[PGbcsProcessor
captureOutput:didOutputSampleBuffer:fromConnection:] in
PGBarcodeScanner.o
"typeinfo for zxing::IllegalArgumentException", referenced from:
GCC_except_table60 in PGBarcodeScanner.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status


Is it because of armv7 architecture?


Micha.

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>

Devgeeks

unread,
Nov 10, 2011, 6:46:33 AM11/10/11
to phon...@googlegroups.com
Try turning off auto reference count?

Michael P

unread,
Nov 10, 2011, 12:09:37 PM11/10/11
to phon...@googlegroups.com
Just read about Automatic Reference Counting. But where can i turn it off?
can't find it...

Thx.

--

Rowan Hick

unread,
Nov 11, 2011, 12:34:12 PM11/11/11
to phonegap
+1 for another interested party. Definitely not an ObjectiveC guy and
struck this problem.

If you got it working Michael, would love to know how.

Thanks
Rowan

On Nov 10, 12:09 pm, Michael P <fent...@googlemail.com> wrote:
> Just read about Automatic Reference Counting. But where can i turn it off?
> can't find it...
>
> Thx.
>
>
>
>
>
>
>
> ---------- Forwarded message ----------
> From: Devgeeks <to...@devgeeks.org>
> Date: Thu, Nov 10, 2011 at 12:46 PM
> Subject: Re: [PhoneGap] Re: barcodescanner not working with phonegap.1.2.0
> To: phon...@googlegroups.com
>
> Try turning off auto reference count?
>
> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group athttp://groups.google.com/group/phonegap?hl=en?hl=en

Zarlok

unread,
Nov 12, 2011, 6:20:48 AM11/12/11
to phonegap
Interest me it... Can you solution it?

Oliver86

unread,
Nov 14, 2011, 3:46:00 AM11/14/11
to phonegap
me too, getting errors because of the arc but can't find a way to
disable it.

I use Xcode 4.2, LLVM GCC 4.2...

Patrick Mueller

unread,
Nov 14, 2011, 12:55:56 PM11/14/11
to phon...@googlegroups.com
On 11/9/11 5:03 AM, fenta23 wrote:
> i recently updated phonegap1.2.0 and migrated my project to the new
> application. i imported the barcodescanner and got the following
> error:
>
> /<mypath>/PGBarcodeScanner.mm:21:26: error: PhoneGap/JSON.h: No such
> file or directory

I've opened up an issue for this:

https://github.com/phonegap/phonegap-plugins/issues/231

--
Patrick Mueller - http://muellerware.org

Patrick Mueller

unread,
Nov 14, 2011, 12:58:20 PM11/14/11
to phon...@googlegroups.com
On 11/10/11 12:09 PM, Michael P wrote:
> Just read about Automatic Reference Counting. But where can i turn it off?
> can't find it...

here's a link to a stack overflow question on the topic:

http://bit.ly/s66gAr


http://stackoverflow.com/questions/7778356/how-to-enable-disable-automatic-reference-counting

Michael P

unread,
Nov 14, 2011, 2:22:52 PM11/14/11
to phon...@googlegroups.com
Thx Patrick,

i will try it...

but any solution for the barcodescanner problem yet?

Micha.

Patrick Mueller

unread,
Nov 15, 2011, 10:07:32 AM11/15/11
to phon...@googlegroups.com
On 11/14/11 2:22 PM, Michael P wrote:
> Thx Patrick,
>
> i will try it...
>
> but any solution for the barcodescanner problem yet?

Just about all caught up with stuff after my vacation, should be looking
into all the barcode scanner issues today.

Patrick Mueller

unread,
Nov 15, 2011, 11:15:30 AM11/15/11
to phon...@googlegroups.com
On 11/14/11 12:58 PM, Patrick Mueller wrote:
> On 11/10/11 12:09 PM, Michael P wrote:
>> Just read about Automatic Reference Counting. But where can i turn it
>> off?
>> can't find it...
>
> here's a link to a stack overflow question on the topic:
>
> http://bit.ly/s66gAr
>
> http://stackoverflow.com/questions/7778356/how-to-enable-disable-automatic-reference-counting

I've opened a new bug to track the potential ARC issue. Looking for
work-arounds. My current thought is that if we can recognize ARC is
enabled for the compilation of the barcode files, that we cause the
compile to generate an error with a diagnostic message that "ARC is not
supported" (with more verbage, on how to recover, presumably).

Any thoughts welcome.

https://github.com/phonegap/phonegap-plugins/issues/235

Joe

unread,
Nov 15, 2011, 8:59:52 AM11/15/11
to phonegap
+1 here. Having the same issue.

On Nov 14, 11:22 am, Michael P <fent...@googlemail.com> wrote:
> Thx Patrick,
>
> i will try it...
>
> but any solution for the barcodescanner problem yet?
>
> Micha.
>
> On Mon, Nov 14, 2011 at 6:58 PM, Patrick Mueller
>
>
>
>
>
>
>
> <pmue...@muellerware.org> wrote:
> > On 11/10/11 12:09 PM, Michael P wrote:
>
> >> Just read about Automatic Reference Counting. But where can i turn it off?
> >> can't find it...
>
> > here's a link to a stack overflow question on the topic:
>
> >    http://bit.ly/s66gAr
>
> >http://stackoverflow.com/questions/7778356/how-to-enable-disable-auto...
>
> > --
> > Patrick Mueller -http://muellerware.org
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "phonegap" group.
> > To post to this group, send email topho...@googlegroups.com
> > To unsubscribe from this group, send email to
> >phonegap+u...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/phonegap?hl=en?hl=en
>
> > For more info onPhoneGapor to download the code go towww.phonegap.com

Joe

unread,
Nov 15, 2011, 8:07:49 PM11/15/11
to phonegap
Changing JSON.h to JSONKit.h worked for me.

Patrick Mueller

unread,
Nov 16, 2011, 1:18:37 PM11/16/11
to phon...@googlegroups.com
On 11/15/11 8:07 PM, Joe wrote:
> Changing JSON.h to JSONKit.h worked for me.

As noted in https://github.com/phonegap/phonegap-plugins/issues/231 , it
turns out that you can just delete the JSON includes. The code used to
use the JSON libraries directly, but changed the code at some point so
that it's no longer needed.

kelly

unread,
Nov 16, 2011, 8:38:53 AM11/16/11
to phonegap
I was able to fix this by using Giorgio's recommendation ("JSONKit.h"
replaces "JSON.h") followed by devgeeks recommendation (turning
automatic reference counting off).

However, to turn ARC off, I had to:

1) select the target in the project navigator
2) select the "build settings" tab
3) in the "build options" section, change the "Compiler for C/C++/
Objective-C" to "Apple LLVM compiler 3.0"
4) then in the "Apple LLVM compiler 3.0 - Language" section, change
the "Objective C Automatic Reference Counting" to "No"

I am running XCode 4.2 Build 4D199 on 10.7.2

Kelly

Patrick Mueller

unread,
Nov 17, 2011, 11:54:21 AM11/17/11
to phon...@googlegroups.com
On 11/16/11 8:38 AM, kelly wrote:
> However, to turn ARC off, I had to:
>
> 1) select the target in the project navigator
> 2) select the "build settings" tab
> 3) in the "build options" section, change the "Compiler for C/C++/
> Objective-C" to "Apple LLVM compiler 3.0"
> 4) then in the "Apple LLVM compiler 3.0 - Language" section, change
> the "Objective C Automatic Reference Counting" to "No"

I've added some proposed verbage to the Barcode Scanner readme
concerning disabling ARC, in the following issue:

https://github.com/phonegap/phonegap-plugins/issues/235#openstruct-118025260

Patrick Mueller

unread,
Nov 17, 2011, 5:44:24 PM11/17/11
to phon...@googlegroups.com
I have just pushed a number of changes to the phonegap-plugins
repository for the iOS BarcodeScanner. Here's a mini-changelog.
Hope this resolves the issues people have been hitting.

I should mention I tested with phonegap 1.2.0 on XCode 4.2 on Mac OSX
10.7. None of the changes I made should cause issues in other environments.

-------------------------------------------------------------
iOS BarcodeScanner: requires old JSON include in the .mm file
-------------------------------------------------------------

https://github.com/phonegap/phonegap-plugins/issues/231

Removed the JSON header files from the .mm file, as they were no longer
needed, and causing compile errors.

-------------------------------------------------------------
iOS BarcodeScanner: README fixes
-------------------------------------------------------------

https://github.com/phonegap/phonegap-plugins/issues/232

The README errors relating to the "barcodeScanner" typo have been
resolved. In addition, a note was added concerning the "build" process
only being needed if you update the zxing code.

-------------------------------------------------------------
iOS BarcodeScanner: does not compile / link when using ARC
-------------------------------------------------------------

https://github.com/phonegap/phonegap-plugins/issues/235

Added notes to the README on how to avoid compilation errors relating to
Automagic Reference Counting (ARC).

Reply all
Reply to author
Forward
0 new messages