2015 R3 Compile error on Foundation NSString

I can’t remember whose library this is but the first time I tried to compile my app in 1015 r3 for the app store I got this error:

Type Mismatch error:Expected Enum Foundation.NSString.NSStringEncoding, but got UInt32
Here’s the code:

  declare function availableStringEncodings lib FoundationLib selector "availableStringEncodings" (class_id as Ptr) as Ptr
  
  const sizeOfUInt32 = 4
  
  dim rb_array() as NSStringEncoding
  
  dim m as MemoryBlock = new MemoryBlock(availableStringEncodings(ClassRef))
  
  dim offset as UInt32 = 0
  while m.UInt32Value(offset) <> 0
    rb_array.append NSStringEncoding(m.UInt32Value(offset))    <----------------This line with rb_array.append NSStringEncoding hilighted.
    offset = offset + sizeOfUInt32
  wend
  
  return rb_array
 

Thanks

Update iOSKit. The fix for this was pushed yesterday.

Is this the correct url?

https://github.com/kingj5/iOSKit

Yes

Now I’m getting a ton of errors.

Here’s a few:

There is no class with this name
mailComposerView = new Extensions.MFMailComposerViewController - Highlighted MFMailViewController

This item does not exist:
if Extensions.MFMailComposerViewController.canSendMail then - Highlighted Extensions.MFMailComposerViewController.

There is no class with this name
outError = new Foundation.NSError(err)

I am using another library call iOSWrapper and it has some declares as well.

@Jason King I have removed the other library and now I need to find replacements for a couple of methods.

The main one I need is the ShowUrl.

  1. ShowURL
ShowURL(url As Text)

  // NSString* launchUrl = @"http://www.xojo.com/";
  // [[UIApplication sharedApplication] openURL:[NSURL URLWithString: launchUrl]];
  
  Declare Function NSClassFromString Lib "Foundation" (name As CFStringRef) As Ptr
  Declare Function sharedApplication Lib "UIKit" Selector "sharedApplication" (obj As Ptr) As Ptr
  Dim sharedApp As Ptr = sharedApplication(NSClassFromString("UIApplication"))
  
  // https://developer.apple.com/library/mac/documentation/UIKit/Reference/Foundation/Classes/NSURL_Class/#//apple_ref/occ/clm/NSURL/URLWithString:
  Declare Function URLWithString Lib "Foundation" Selector "URLWithString:" ( id As Ptr, URLString As CFStringRef ) As Ptr
  Dim nsURL As Ptr = URLWithString(NSClassFromString("NSURL"), url)
  
  // https://developer.apple.com/Library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/occ/instm/UIApplication/openURL:
  Declare Function openURL Lib "UIKit" Selector "openURL:" (id As Ptr, nsurl As Ptr) As Boolean
  Return openURL(sharedApp, nsURL)
  1. ClearFocus
ClearFocus(extends c As iOSControl)
  declare sub resignFirstResponder lib "Foundation.Framework" selector "resignFirstResponder" (obj_id as Ptr)
  
  resignFirstResponder(c.handle)
  1. SetFocus
SetFocus(extends c As iOSControl)
  declare sub becomeFirstResponder lib "Foundation.Framework" selector "becomeFirstResponder" (obj_id as Ptr)
  
  becomeFirstResponder(c.handle)

Thanks

Those methods are ready in Xojo code… Just copy them into a module in your project…

This code from XojoiOSWrapper which is already a module. I do not see how these methods could interfere with iOSKit, or trigger the reported errors.

Agreed. Maybe he didn’t add iOSKit back in?

What would I use for the ShowURL?

The reported errors look like something missing. It is not from iOSWrapper, and am not familiar enough with iOSKit method names to be sure. Could be his code as well.

Just use iOSWrapper which was not the issue…

Or if you prefer, just use the ShowURL method you posted.