Closed KODerFunk closed 8 years ago
Interesting - if I use that I don't get Откуда взять фото?
but an encoded version.. I had to change this for #35, but indeed yours crashes. Any ideas?
Try spain words with my trick (without NSISOLatin1StringEncoding
). If it work — it must be fixed!)
I did but it didn't work for me. Perphaps I have the syntax wrong?
Can it been auto-tested? I can prepare detailed report, if you want
I'm simply trying it like this:
function testShareSheet() {
var options = {
'title': 'Откуда взять фото?',
'buttonLabels': ['Español', 'Inglés'],
'addCancelButtonWithLabel': 'What\'s Español?',
'addDestructiveButtonWithLabel' : 'Remove Inglés'
};
window.plugins.actionsheet.show(options, function(){});
};
And the result with
[NSString stringWithCString:[input cStringUsingEncoding:NSUTF8StringEncoding] encoding:NSUTF8StringEncoding];
(which is the same as not encoding it at all) is:
Do you see a similar result?
I'm going to roll my last change back so your case works again, but Spanish will break again. Ideas?
I try use your options in my app http://take.ms/NduTs with my dirty-fix:
Then I return NSISOLatin1StringEncoding
, cordova run ios ...
, tap..tap...tap
, crash!
Crashshot: http://take.ms/oNPsj
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithCString:encoding:]: NULL cString'
*** First throw call stack:
(
0 CoreFoundation 0x000000010fe8de65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001132e8deb objc_exception_throw + 48
2 CoreFoundation 0x000000010fe8dd9d +[NSException raise:format:] + 205
3 Foundation 0x0000000112eaedc4 +[NSString stringWithCString:encoding:] + 84
4 * 0x000000010fb23803 -[ActionSheet encodeString:] + 147
5 * 0x000000010fb22cbb __20-[ActionSheet show:]_block_invoke + 91
6 libdispatch.dylib 0x0000000113ad1e5d _dispatch_call_block_and_release + 12
7 libdispatch.dylib 0x0000000113af249b _dispatch_client_callout + 8
8 libdispatch.dylib 0x0000000113adabef _dispatch_root_queue_drain + 1829
9 libdispatch.dylib 0x0000000113ada4c5 _dispatch_worker_thread3 + 111
10 libsystem_pthread.dylib 0x0000000113e2a68f _pthread_wqthread + 1129
11 libsystem_pthread.dylib 0x0000000113e28365 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Could this be due to the fact that all my sources utf8-encoded and <meta charset="utf-8" />
in index.html/head
?
System and phone locale is ru
/ru-RU
.
Ha, that's it!
You just need to add <meta charset="utf-8" />
meta tag and all encoding is just fine. So the 2.2.2 release should work fine for you with that tag added, thanks for the pointer!
Thank You, @EddyVerbruggen!
Not working for me with 2.2.2. I have <meta charset="utf-8" />
in index.html and any non-ASCII characters in buttonLabels are crashing the app. I have bullet points to denote which option is currently active.
buttonLabels: ['Closing Date', '• Average Critic Rating •']
@martinjbaker Works fine on my sim and device (see screenshot).
Can you try removing the iOS platform and adding it again, same for the plugin? And make sure the html/js files are UTF-8 encoded as well.
Yep that fixed it, thanks.
Crash in
encodeString
https://github.com/EddyVerbruggen/cordova-plugin-actionsheet/blob/master/src/ios/ActionSheet.m#L67Fix in project localy by change
NSISOLatin1StringEncoding
=>NSUTF8StringEncoding
incStringUsingEncoding
call.Used title:
Откуда взять фото?