iOSLib

Greetings and I hope everyone is well.

I’ve just started an iOS Xojo project and I’m running into obstacles. I want to have a picture backdrop on a view, and have a few buttons on that view, but the buttons are not responding to clicks in the simulator. It looks like I need iOS Kit from what I can glean on the forums here about this issue.

I’ve downloaded iOSLib from GitHub but the following error has me stumped. Am I doing something wrong or not added a component or something?

[quote]Linking Executable
ld: building for iOS, but linking against dylib built for OSX, file ‘/usr/lib/system/libdispatch.dylib’ for architecture x86_64[/quote]

Any ideas?

Edit: If forgot to mention I’m using the latest Xojo 2018r1.1 Pro.

Cheers
Grant

What you need is:

Declare function userInteractionEnabled_ lib UIKitLib selector “setUserInteractionEnabled:” (obj_id as ptr, yesNo as Boolean)

userInteractionEnabled_(myImageView.Handle, True)

As for iOSKit - it’s a different thing than iOSLib. IOSKit is available at https://github.com/kingj5/IOSKit (link also in my signature). If you are familiar with git I recommend you fork the project so you can pull updates when they are made available. The project has some examples included but all you need to do is copy the Modules folder into your project for everything to be available.

Jason,

Thanks for your input.

Just another problem, is this supposed to be a function or a sub? This doesn’t work as a function. It complains about a return value. I changed it to a sub and it will compile, but the app crashes.

Any thoughts?

Cheers
Grant

Whoops yeah should be a sub. I just threw it together on the forum yesterday. Can you show the crash log? I might have something else wrong in the declare.

Jason,

Yes this might be what you’re looking for:

[code]Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information:
*** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[XOJViewController setUserInteractionEnabled:]: unrecognized selector sent to instance 0x124603d40’
terminating with uncaught exception of type NSException
abort() called
CoreSimulator 518.22 - Device: iPhone 6s - Runtime: iOS 11.4 (15F79) - DeviceType: iPhone 6s

Application Specific Backtrace 1:
0 CoreFoundation 0x0000000106ec51e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000104948031 objc_exception_throw + 48
2 CoreFoundation 0x0000000106f46784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 UIKit 0x00000001005676db -[UIResponder doesNotRecognizeSelector:] + 295
4 CoreFoundation 0x0000000106e47898 forwarding + 1432
5 CoreFoundation 0x0000000106e47278 _CF_forwarding_prep_0 + 120
6 FullCredit.debug 0x0000000100027912 iOSExtensions.=$AllowUserInteraction%%ob + 354
7 FullCredit.debug 0x0000000100030c24 View1.View1.Event_Open%%o<View1.View1> + 132
8 FullCredit.debug 0x0000000100014a6d iOSView.Constructor%%o + 1389
9 FullCredit.debug 0x000000010002768d iPhoneScreen.Event__Layout%%o + 269
10 FullCredit.debug 0x0000000100012861 iOSScreen.Constructor%%o + 113
11 FullCredit.debug 0x00000001000359dc _MakeDefaultScreen + 268
12 FullCredit.debug 0x0000000100035bae _Startup + 110
13 rbframework.dylib 0x0000000106bce13d GetIOSAppWindowHandle + 670
14 UIKit 0x00000001003306fb -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 278
15 UIKit 0x0000000100332172 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4123
16 UIKit 0x00000001003375cb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1677
17 UIKit 0x00000001006f9f7e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
18 UIKit 0x0000000100acca39 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
19 UIKit 0x00000001006f9bba -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
20 UIKit 0x00000001006fa3db -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
21 UIKit 0x000000010106b614 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
22 UIKit 0x000000010106b4ae -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
23 UIKit 0x0000000100d4f75d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
24 UIKit 0x0000000100f4a4b7 _performActionsWithDelayForTransitionContext + 100
25 UIKit 0x0000000100d4f627 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
26 UIKit 0x0000000100acc0e0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
27 UIKit 0x0000000100335eac -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
28 UIKit 0x0000000100908bcb -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
29 FrontBoardServices 0x000000010a0682f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
30 FrontBoardServices 0x000000010a070cfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
31 libdispatch.dylib 0x0000000107c3b709 _dispatch_client_callout + 8
32 libdispatch.dylib 0x0000000107c408c1 _dispatch_block_invoke_direct + 317
33 FrontBoardServices 0x000000010a09c470 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24
34 FrontBoardServices 0x000000010a09c12e -[FBSSerialQueue _performNext] + 439
35 FrontBoardServices 0x000000010a09c68e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
36 CoreFoundation 0x0000000106e67bb1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17
37 CoreFoundation 0x0000000106e4c4af __CFRunLoopDoSources0 + 271
38 CoreFoundation 0x0000000106e4ba6f __CFRunLoopRun + 1263
39 CoreFoundation 0x0000000106e4b30b CFRunLoopRunSpecific + 635
40 GraphicsServices 0x000000010734ba73 GSEventRunModal + 62
41 UIKit 0x0000000100339057 UIApplicationMain + 159
42 rbframework.dylib 0x0000000106bce7bd GetIOSAppWindowHandle + 2334
43 FullCredit.debug 0x0000000100001f0d Xojo._RuntimeRun + 29
44 FullCredit.debug 0x0000000100035efd _Main + 749
45 FullCredit.debug 0x00000001000351e3 main + 19
46 libdyld.dylib 0x0000000107cb0955 start + 1
[/code]

What is your code where you call that? It looks like you are passing the iOSView in. You need to instead pass the actual image view object’s handle.

I set it in the open event using this extension:

[code]Public Sub AllowUserInteraction(extends view as iOSView, assigns value as Boolean)
declare sub userInteractionEnabled_ lib “UIKit” selector “setUserInteractionEnabled:” (obj_id as ptr, yesNo as Boolean)

userInteractionEnabled_(view.Handle, value)
End Sub[/code]

This is view1 which is the view that loads on launch.

Cheers
Grant

This should work:

[code]Public Sub AllowUserInteraction(extends imgView as iOSImageView, assigns value as Boolean)
declare sub userInteractionEnabled_ lib “UIKit” selector “setUserInteractionEnabled:” (obj_id as ptr, yesNo as Boolean)

userInteractionEnabled_(imgView, value)
End Sub[/code]

Jeremie,

Thank you so much for your reply. Yes this worked. Moving on.

I’m now wondering why stuff like this is not already built into Xojo??

Cheers
Grant

You’re welcome Grant !
I consider this as an advanced feature, which is sort of hidden in the Apple iOS docs.
Just like on Desktop, there are some features that are only available using declares.

My original problem still remains:

[quote]Linking Executable
ld: building for iOS, but linking against dylib built for OSX, file ‘/usr/lib/system/libdispatch.dylib’ for architecture x86_64[/quote]

I know what is wrong but I don’t know how to fix it.

Cheers
Grant

Are you sure you have iOSKit installed? It is distinct from iOSLib.

Edit: And if you are using iOSLib you need to move to AppleLib instead I think. Ulrich said that he is no longer supporting iOSLib about 2 years ago. If there is something specific that you need in iOSLib that iOSKit doesn’t have I can see if that can be added as well. Trying to use them in the same project is difficult at best.

Do you still need iOSLib ?

Maybe @Ulrich Bogun can help

Sorry for not seeing this; my ISP created some outages during the last days for me and I must have missed the thread in the hundreds of mails that arrived later.
Please try to change to constant name to

/usr/lib/libSystem.dylib

I do not maintain this version of AppleLib anymore. I started a new one with better integration of shared code which is now on hold due to the changes API 2.0 will bring.

Ulrich,

Thanks!! This is now working and my app is looking awesome!!

Cheers
Grant

Ulrich,

I’m trying to submit my iOS app to the Apple App Store, but I’ve received an email from Apple after submitting as follows:

[quote]Dear Developer,

We identified one or more issues with a recent delivery for your app, “XXXXXXX The App”. Please correct the following issues, then upload again.

Non-public API usage:

The app references non-public selectors in XXXXXXX-The App: cgColor, pointValue, rectValue, setInputFormat:forBus:, sizeValue, timeStamp, valueWithPoint:, valueWithRect:, valueWithSize:
If method names in your source code match the private Apple APIs listed above, altering your method names will help prevent this app from being flagged in future submissions. In addition, note that one or more of the above APIs may be located in a static library that was included with your app. If so, they must be removed.[/quote]

Any ideas on how to fix this?

Cheers
Grant

Please locate the getsizevalue, getrectvalue and getpointvalue external method declarations in AppleValue.
Duplicate them.
Uncheck the originals’ iOS checkboxes in Inspector.
Make sure the new copies have the same name (remove their 1s), und make their selectors

CGSizeValue, CGRectValue, CGPointValue

Check only their iOS check boxes.

Repeat the same with valuewithpoint, valuewithSize and ValuewithRect - name the iOS selectors

valueWithCGPoint:, valueWithCGSize:, valueWithCGRect:

In AVAudioNode, remove the setter of the inputFormat property and the setinputformat external method. This is read-only.
The same should apply for outputformat. I wonder why that wasn’t noted?

I cannot find selectors named cgColor and timestamp (with these exact cases) but I know the first one exists in iOSKit. Do you use it too?

EDIT: Now I could find timestamp:
Please locate AppleNSEvent und make the property Timestamp and the external method gettimestamp macOS-only.

For cgColor, still, I cannot find it but this selector should be named “CGColor”.

Ulrich,

Thank you very much for your response, this has cleared up my app with only one problem left. Have you seen this one before? I can’t find the info.plist so I can modify it:

[quote]Dear Developer,

We identified one or more issues with a recent delivery for your app, “Full Credit Podcast The App”. Please correct the following issues, then upload again.

Missing Info.plist key - This app attempts to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data.

Best regards,

The App Store Team[/quote]

Glad to hear that, Grant!

About the plist: There is none by default in your project, so you have to create it. See the LR.

[quote=400432:@Ulrich Bogun]Glad to hear that, Grant!

About the plist: There is none by default in your project, so you have to create it. See the LR.[/quote]
Just for clarity, what you are entering in the plist is a message that will appear to the user in the confirmation dialog which explains why your app wants access to the microphone.