Post

Replies

Boosts

Views

Activity

Reply to Random C++ compiler errors in Xcode 15.3 (15E204a)
First, do read the notes on the cppreference page for isspace: https://en.cppreference.com/w/cpp/string/byte/isspace Like all other functions from , the behavior of std::isspace is undefined if the argument's value is neither representable as unsigned char nor equal to EOF. To use these functions safely with plain chars (or signed chars), the argument should first be converted to unsigned char Similarly, they should not be directly used with standard algorithms when the iterator's value type is char or signed char. Instead, convert the value to unsigned char first As to why it doesn't work, consider this: int foospace(int c) { return c == ' '; } int foospace(char c) { return c == ' '; } void foo() { const std::string text = "Hello Cruel World!"; auto is_empty = std::all_of(text.begin(), text.end(), foospace); } That fails, but remove either one of the overloads and it works. std::isspace in is supposed to take an int. I don't know where the other overload is coming from, nor what its argument type is. It's unfortunate that the compiler doesn't point out the overloads that it has considered. You might like to grep the headers! So std::isspace is now the name of an overload-set, not a function. Sometimes that works, if the function signatures are sufficiently different, but clearly not in this case. The various ways to convert an overload-set to one of its members are described here: https://en.cppreference.com/w/cpp/language/overloaded_address One option is to assign to a function pointer of the correct type, which is what Quinn has done. Another is simply to cast: auto is_empty = std::all_of(text.begin(), text.end(), static_cast<int(*)(int)>(std::isspace)); But don't do that, because of the char vs. unsigned char issue mentioned at the start.
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’24
Reply to Digital Services Act compliance - are non-profits non-traders?
IANAL. Non-profits can trade. Consider e.g. a charity that sells you a T-shirt and uses the income from that for their good works. That's certainly trading. On the other hand, a non-profit may be a non-trader. For example, if you just give things away. That's probably not trading. @Psalm103 , from your user name I'm guessing you might be a church. There may be special rules specifically related to religious groups. Ask your accountant!
Mar ’24
Reply to Non-convex collision?
In general, decomposing a concave object into a set of convex objects is difficult. I.e. it's NP-Hard. There is lots of literature about this, including some approximation algorithms. Search the web. But I note that the original question referred to "terrain". Is this concave object terrain? That is an interesting special case which may be easier to solve. Note that I know next-to-nothing about ARKit / RealityKit, but I do know a fair bit about geometry algorithms in general.
Topic: Spatial Computing SubTopic: General Tags:
Mar ’24
Reply to How to set a price for in-app purchases so I get a specific amount after taxes and fees?
However, once I set a price on the App Store in USD, there is a large variation in the amount I will be paid from other countries and currencies as each country levies its own tax. Any workarounds or ways in which I can tell the App Store what I want to be paid after taxes so that prices are adjusted in each country accordingly?? In theory, that's what it is supposed to do. It is supposed to choose prices that give approximately the same proceeds for all countries; at https://developer.apple.com/help/app-store-connect/manage-app-pricing/set-a-price they say: "Automatically generated prices account for foreign exchange rates and certain taxes". In practice, they've got it badly wrong in some cases. I think that in part this is because they round customer prices to nice-looking numbers. For example, if I set my base GBP price to various values between £1 and £2, the automatic USD prices are always either $0.99 or $1.99; it never chooses anything in between. But that doesn't explain everything; I just discovered that a GBP base price of £98.90 is automatically converted to AU$149.99, which gives 15% lower proceeds; a much closer conversion would be AU$174.99. This actually worked better before they introduced the current system last year. So anyway... if you want the conversions to be more accurate than about +/- 30%, you will need to set prices manually, at least for the most important regions. It is possible to automate the process using the App Store Connect API; whether that is worth doing will depend on how many different prices you have and how good you are at wrangling JSON and deciphering Apple's docs. See also: https://developer.apple.com/forums/thread/732527 https://developer.apple.com/forums/thread/744277
Topic: App & System Services SubTopic: StoreKit Tags:
Mar ’24
Reply to Swift Cpp/c++ interop: swift functions with c++ enums arguments not available in c++
enum class MyCppEnum { D, E, F }; I think you meant enum MyCppEnum { D, E, F }; I can’t answer your question though. I think I have used swift enums in C++, but there was something nasty about it; maybe it mangled the names in some way? That’s right, it generated a non-class enum with the enum name prefixed to all the element names. I think it is safe to cast, rather than needing that switch.
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’24
Reply to allowsBackgroundLocationUpdates clarifications
I think that if you have whenInUse auth, you can start getting updates in the foreground, then go to the background and continue to get them. Turning locations on while in the background may need the always auth. I take it you are using a bluetooth background mode in order to be running in the background with locations off, right? This is an unusual situation.
Topic: App & System Services SubTopic: Core OS Tags:
Mar ’24
Reply to Random C++ compiler errors in Xcode 15.3 (15E204a)
First, do read the notes on the cppreference page for isspace: https://en.cppreference.com/w/cpp/string/byte/isspace Like all other functions from , the behavior of std::isspace is undefined if the argument's value is neither representable as unsigned char nor equal to EOF. To use these functions safely with plain chars (or signed chars), the argument should first be converted to unsigned char Similarly, they should not be directly used with standard algorithms when the iterator's value type is char or signed char. Instead, convert the value to unsigned char first As to why it doesn't work, consider this: int foospace(int c) { return c == ' '; } int foospace(char c) { return c == ' '; } void foo() { const std::string text = "Hello Cruel World!"; auto is_empty = std::all_of(text.begin(), text.end(), foospace); } That fails, but remove either one of the overloads and it works. std::isspace in is supposed to take an int. I don't know where the other overload is coming from, nor what its argument type is. It's unfortunate that the compiler doesn't point out the overloads that it has considered. You might like to grep the headers! So std::isspace is now the name of an overload-set, not a function. Sometimes that works, if the function signatures are sufficiently different, but clearly not in this case. The various ways to convert an overload-set to one of its members are described here: https://en.cppreference.com/w/cpp/language/overloaded_address One option is to assign to a function pointer of the correct type, which is what Quinn has done. Another is simply to cast: auto is_empty = std::all_of(text.begin(), text.end(), static_cast<int(*)(int)>(std::isspace)); But don't do that, because of the char vs. unsigned char issue mentioned at the start.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to Digital Services Act compliance - are non-profits non-traders?
IANAL. Non-profits can trade. Consider e.g. a charity that sells you a T-shirt and uses the income from that for their good works. That's certainly trading. On the other hand, a non-profit may be a non-trader. For example, if you just give things away. That's probably not trading. @Psalm103 , from your user name I'm guessing you might be a church. There may be special rules specifically related to religious groups. Ask your accountant!
Replies
Boosts
Views
Activity
Mar ’24
Reply to Non-convex collision?
In general, decomposing a concave object into a set of convex objects is difficult. I.e. it's NP-Hard. There is lots of literature about this, including some approximation algorithms. Search the web. But I note that the original question referred to "terrain". Is this concave object terrain? That is an interesting special case which may be easier to solve. Note that I know next-to-nothing about ARKit / RealityKit, but I do know a fair bit about geometry algorithms in general.
Topic: Spatial Computing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to How to set a price for in-app purchases so I get a specific amount after taxes and fees?
However, once I set a price on the App Store in USD, there is a large variation in the amount I will be paid from other countries and currencies as each country levies its own tax. Any workarounds or ways in which I can tell the App Store what I want to be paid after taxes so that prices are adjusted in each country accordingly?? In theory, that's what it is supposed to do. It is supposed to choose prices that give approximately the same proceeds for all countries; at https://developer.apple.com/help/app-store-connect/manage-app-pricing/set-a-price they say: "Automatically generated prices account for foreign exchange rates and certain taxes". In practice, they've got it badly wrong in some cases. I think that in part this is because they round customer prices to nice-looking numbers. For example, if I set my base GBP price to various values between £1 and £2, the automatic USD prices are always either $0.99 or $1.99; it never chooses anything in between. But that doesn't explain everything; I just discovered that a GBP base price of £98.90 is automatically converted to AU$149.99, which gives 15% lower proceeds; a much closer conversion would be AU$174.99. This actually worked better before they introduced the current system last year. So anyway... if you want the conversions to be more accurate than about +/- 30%, you will need to set prices manually, at least for the most important regions. It is possible to automate the process using the App Store Connect API; whether that is worth doing will depend on how many different prices you have and how good you are at wrangling JSON and deciphering Apple's docs. See also: https://developer.apple.com/forums/thread/732527 https://developer.apple.com/forums/thread/744277
Topic: App & System Services SubTopic: StoreKit Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to Swift Cpp/c++ interop: swift functions with c++ enums arguments not available in c++
enum class MyCppEnum { D, E, F }; I think you meant enum MyCppEnum { D, E, F }; I can’t answer your question though. I think I have used swift enums in C++, but there was something nasty about it; maybe it mangled the names in some way? That’s right, it generated a non-class enum with the enum name prefixed to all the element names. I think it is safe to cast, rather than needing that switch.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to allowsBackgroundLocationUpdates clarifications
I think that if you have whenInUse auth, you can start getting updates in the foreground, then go to the background and continue to get them. Turning locations on while in the background may need the always auth. I take it you are using a bluetooth background mode in order to be running in the background with locations off, right? This is an unusual situation.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Mar ’24
Reply to Where I can find ip range for iOS app?
Our app is to used inside company Beware, Apple may not want it on the app store if it's a "private" app. Note if you search the forum you will find this question about IP ranges asked previously; I don't recall any more detailed answers but maybe I missed something.
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Mar ’24